OPERATORS
[PROJECT: COOKIE CLICKER]
WARM UP
Take a look at this JSFiddle and fix the bugs(errors):

http://jsfiddle.net/appAcademyDan/8LUhJ/
REVIEW
From the previous JSFiddle:

What is an example of a variable?
What is an example of a value?
What is an example of...
DEFINITIONS - OPERATOR
What are they?
Operators are symbols that are used to add(+), subtract(-), multiple(*), divide(/) a...
DEFINITION - COMMENTS
What Is It?
Comments are text that explains lines of code. Comments are ignored by the program
and a...
EXAMPLES OF OPERATORS IN ACTION
Addition

Multiplication

var add=5+15;
alert(add);

var mul=5*15;
alert(add);

Subtractio...
TRY THIS JSFIDDLE!
http://jsfiddle.net/appAcademyDan/5aENL/
EXAMPLES OF VARIABLE MATH AND MOD
Var Math

Modulo

var num1=5;
var num2=10;
var add=num1+num2;
alert(add);

var mod=15%5;...
TRY THIS JSFIDDLE!
http://jsfiddle.net/appAcademyDan/S7dnF/
HOMEWORK
http://jsfiddle.net/appAcademyDan/ePhW8/
TICKET OUT THE DOOR
Identify the operators, value, and types of

data in each of the equations below.
var num1 = 5 + 15;

...
Upcoming SlideShare
Loading in …5
×

CCv1.0 ppt02 - operators

194 views
89 views

Published on

Published in: Education, Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
194
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

CCv1.0 ppt02 - operators

  1. 1. OPERATORS [PROJECT: COOKIE CLICKER]
  2. 2. WARM UP Take a look at this JSFiddle and fix the bugs(errors): http://jsfiddle.net/appAcademyDan/8LUhJ/
  3. 3. REVIEW From the previous JSFiddle: What is an example of a variable? What is an example of a value? What is an example of an assignment operator? *Write down answer and the line number you would find each.
  4. 4. DEFINITIONS - OPERATOR What are they? Operators are symbols that are used to add(+), subtract(-), multiple(*), divide(/) and do modulo(%) on numbers. The modulo operator returns the remainder after dividing two numbers. Example of Operators var sodaCost = 1.00; var chipsCost = 2.00; var totalCost = sodaCost + chipsCost; // 4 divides evenly into 10 two times, this leaves a remainder of 2 left over. var remainder = 10 % 4;
  5. 5. DEFINITION - COMMENTS What Is It? Comments are text that explains lines of code. Comments are ignored by the program and are only meant for the programmer to read. How do you use them? There are two ways to add comments: two forward slashes “//” lets you add one comment line. Using forward slashes with asterisks “/* */” lets you add one or more lines of comments between the asterisks. Example of Comments /* We can add numbers together using Operators. Take a look at the following example! */ var numCookies = 5 + 1; // We can also divide two numbers using the division(/) operator! var cookiesPerSecond = 10 / 5;
  6. 6. EXAMPLES OF OPERATORS IN ACTION Addition Multiplication var add=5+15; alert(add); var mul=5*15; alert(add); Subtraction Division var sub=5-15; alert(sub); var div=5/15; alert(div);
  7. 7. TRY THIS JSFIDDLE! http://jsfiddle.net/appAcademyDan/5aENL/
  8. 8. EXAMPLES OF VARIABLE MATH AND MOD Var Math Modulo var num1=5; var num2=10; var add=num1+num2; alert(add); var mod=15%5; alert(mod); Var Math Modulo var mul=num1*num2; alert(mul); var mod=23%5; alert(mod);
  9. 9. TRY THIS JSFIDDLE! http://jsfiddle.net/appAcademyDan/S7dnF/
  10. 10. HOMEWORK http://jsfiddle.net/appAcademyDan/ePhW8/
  11. 11. TICKET OUT THE DOOR Identify the operators, value, and types of data in each of the equations below. var num1 = 5 + 15; Operators: _________________ Value: _____________________ Type: ______________________ var mod = num1%3; Operators: _________________ Value: _____________________ Type: ______________________

×