Comments are notes for myself or others that are reading my code.
// This is how to comment.
/* This is how to comment
many lines */
Declare a variable by using var in front.
Store a value in a variable with the assignment operator.
myVariable = 6;
Initialize a variable to an initial value in line it is declared
var myVar = 7;
This is a new variable called myVar with an initial value of 7
Math operations with no defined variable is Nan or “Not a Number”
Case Sensitivity in Variables
var sum = 1 + 2;
var difference = 27 – 13;
var product = 5*2;
var quotient = 45/0;
Increment or add 1 to a variable with ” ++”
this means b + 1;
Decrement or decrease a variable by 1 with “–”
this means b – 1;
var product = 3.0 * 0.0
var quotient = 0.0/ 3.0;
% is the remainder operator
5 % 2 =1
2 * 2 =4
5 – 4 = 1 (Remainder)
Compound Assignment with Augmented Subtraction
-= subtracts a number from a variable
Compound Assignment with Augmented Multiplication
*= multiplies a variable by a number
myVar *= 3;