Using variables in math is quite self-explanatory. A lot of times you will create another variable for your equation. (Or use an object, but that 's pretty far into the future).
var a = 12;
var b = 3;
var c = a + b;This will make the variable 'c', have a value of 15! Now, this may confuse some people, so I will explain the other mathematical terms.
Multiplication: *
Division: /
Adding: +
Subtraction: -
To the power of: ^
YOU ARE READING
JavaScript for Newbies
Non-FictionThis is a step by step tutorial book on how to program in JavaScript. From beginner to Expert!