JavaScript doesn't have a conception of different types of numbers such as integers, floats, or doubles—everything is simply a number. All the basic arithmetic methods are built-in, and the Math object provides the rest of the functionality you'd expect to find built into a programming language. Here's an example:
let myNumber = 2.14
myNumber = Math.floor(myNumber) // myNumber now equals 2
You can also use scientific notation, as shown:
myNumber = 123e5 // myNumber is 12300000
Numbers in JavaScript are not just any old numbers, but are, inherently, floats. To be technical, they are stored as double-precision floating-point numbers following the international IEEE 754 standard. However, this does lead to a couple of…interesting…quirks. Keep this in mind if you get strange results, such as in the following screenshot from the JavaScript console:
A rule of thumb is to think about what precision...