JavaScript numbers natively support conversion to binary representations via the Number#toString()
method. To perform some operation on the binary representation, I converted the number into its binary representation and later into the number as follows,
Example 1 :
(117).toString(2) => "1110101"
Number("1110101") => 1110101
Example 2 :
(999999).toString(2) => "11110100001000111111"
//I don't understand this
Number("11110100001000111111") => 11110100001000112000
How does Example 2 work, I expected the result to be 11110100001000111111
but I received 11110100001000112000.
Why does Number("11110100001000111111")
return 11110100001000112000
?