Successfully reported this slideshow.
Upcoming SlideShare
×

# CCv1.0 ppt02 - operators

213 views

Published on

• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

### 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;