Ch. 2, parseInt(): book claims can be used for converting to binary, etc.?
In the "Data Conversion" section of Chapter 2, the book claims that "you can use parseInt() to convert numbers to binary (Base 2), hex (Base 16), and other number systems." In reality, it does the opposite.
The method toString() is the method that is useful for converting a number to different number systems, not parseInt(). parseInt(10, 2) results in the number 2, as the book says, but that is not a conversion of ten into binary, but an interpretation of 10 as being binary already, in which case its base 10 value would be 2. The base 10 value of ten would be represented 1010 in binary.
Has anyone else noticed this error? Is there something I am missing here?
|