Binary and Octal Literals
For starters, programmers can now use prefixes to represent the different number systems in ES6.
So for representing binary digits, the prefix 0b can be used while for representing octal numbers, the prefix 0o can be used.
Number.NaN is different than its global counterpart. It does not cast it’s input through Number(value) before comparision.
Number.NaN returns if the provided value IS NaN.
The confusing thing is, typeof NaN === number
So, typeof value === number, does not accurately tell you if value is a number. It gives the set of all numbers AND NaN
So, a more accurate way to determine if value is a number is:
typeof value === ‘number’ && !Number.isNaN(value)
Of course, other ways of working around values being incorrectly described as numbers include, Number(x) === x which will return true for numbers only.
Number.isFinite differs from the global isFinite as well, in that Number.isFinite does not cast values through Number(value) before evaluation.
Global isFinite will evaluate non-numbers as finite!
This is because global isFinite is casting values to Number(value) before evaluation.
For instance, Non-numbers cast to numbers can equal 0. Number(null)===0
Number.isFinite is superior in this regard.
This is new in ES6, and will determine if a number is an integer. No casting to Number() is done, so you can be sure non-numbers like null will evaluate false.
Number.parseInt and Number.parseFloat behave exactly as their global counterparts without exceptions.
Of course, the MIN safe integer is the negative of the MAX number. Remember how computers store numbers in memory.
Number.isSafeInteger simply returns if the provided number is between the MIN and MAX values above.
.1 plus .2 does not equal .3!
Number.EPSILON provides an acceptable margin of error for use in computations. So, can be used to determine an acceptable margin of error, like this: