Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
Welcome back, In the previous article we learned about
Computer’s and data, these two words have an awesome relationship with each other. Inside the computer’s world, there is only data. Read the data, modify the data, create a new data—simply put, data is everything according to me when it comes to Programming.
According to the ECMAScript standard, there is only one number type: the double-precision 64-bit binary format IEEE 754 value (number between -(253 -1) and 253 -1). There is no specific type for integers. In addition to being able to represent floating-point numbers, the number type has three symbolic values:
double. There is no separate integer type, so please remember that
Extra large or extra small numbers can also be written with scientific (exponent) notation:
Does that example mean “add 4 and 100, and multiply the result by 11”, or is the multiplication done before the adding? As you might have guessed, the multiplication happens first. But as in mathematics, you can change this by wrapping the addition in parentheses.
-Infinity, which represents the positive and negative infinities. Please note that
Infinity - 1 is still Infinity, and so on. The value
Infinity represents all values greater than
I would urge you that you should not have trust in infinity-based computation as this isn't mathematically solid, and it will quickly lead to our next special number: NaN.
NaN would stand for “not a number". For example, when you are trying to calculate 0 / 0 (zero divided by zero), Infinity - Infinity, or any number of other numeric operations that don’t return an explicit, and meaningful result.
Testing against NAN: NaN would compare unequal values (via
!==... Don't worry we will talk about these logical operators soon) to any other value - including to another NaN value. Use
isNaN() to explicitly determine whether value is NaN or not. You can also perform a self-comparison: NaN and only NaN will compare unequal to itself.
If you made it here to this paragraph, you are awesome. Next up we will cover Strings and ES6 Template Strings. Check that article here.
This story has been proudly referenced by these books below:
Thanks a lot…
If you would like to hire me for your next cool project, or just want to say hello… my twitter handle is @harmanmanchanda for getting in touch with me! My DM’s are open to the public so just hit me up.