Java Reference
In-Depth Information
> 1000000..toString(36) // a million in base 36
<< "lfls"
Parsing Numbers
There is also a useful function called parseInt() that can be used to convert a string
representation of a numerical value back into an integer. You can specify the base of the
number you are trying to convert, for example:
parseInt("1010",2); // converts from binary, back to
<< 10
<< 31912
<< 23
If a string starts with a number, the parseInt function will use this number and ignore
any letters that come afterwards:
var address = "221B Baker Street"
<< undefined
parseInt(address, 10)
<< 221
If you try to do this with the Number function, it returns NaN :
<< NaN
And if you use parseInt with a decimal, it will remove anything after the decimal point:
<< 2
Search WWH ::

Custom Search