Friday, 20 October 2017

JAVASCRIPT-Math Operators.

Math Operators

Don't worry! Math doesn't need to be your strong-suit to learn JavaScript. However, there are operators you'll need to know to make useful programs.
JavaScript supports the following math operators:
  1. Add: +
  2. Subtract: -
  3. Multiply: *
  4. Divide: /
These all work how you might guess:
console.log(3 + 4); // Equals 7 console.log(5 - 1); // Equals 4 console.log(4 * 2); // Equals 8 console.log(9 / 3); // Equals 3
In the example above, each line uses a different mathematical operator to log a value to the console.
Share:

0 comments:

Post a Comment