Essential JavaScript

Multiply and Divide

We can multiply with JavaScript. Try running the following lines in the editor:

  • 3 * 4
  • 2 * 2 * 2

We can also divide with JavaScript. Try the following lines:

  • 4 / 2
  • 21 / 3
  • 66 / 3 / 2

Floating Point Numbers

What happens when we divide numbers that don't split evenly? Try it:

  • 1 / 2
  • 10 / 3

JavaScript can work with integers like 1, 2, and so on. These numbers have no decimal point.

JavaScript also understands numbers with decimals in them like 0.5 and 3.14. These are called floating point numbers.

Some programming languages force you to label each number as an integer or floating point number. JavaScript does not. All numbers are numbers to JavaScript, and it is happy to mix and match them when doing math.


Learning Goals

Code Editor