Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
152
rated 0 times [  153] [ 1]  / answers: 1 / hits: 16361  / 14 Years ago, tue, april 13, 2010, 12:00:00

I'm just wondering what it means to attach a number as a parameter to the toString() method



E.g. obj.toString(10);



I googled and i have never seen a parameter before.


More From » tostring

 Answers
37

The additional parameter works only for Number.prototype.toString to specify the radix (integer between 2 and 36 specifying the base to use for representing numeric values):



var number = 12345;
number.toString(2) === 11000000111001
number.toString(3) === 121221020
// …
number.toString(36) === 9ix

[#97082] Sunday, April 11, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ingridcassieb

Total Points: 346
Total Questions: 97
Total Answers: 125

Location: North Korea
Member since Fri, Nov 4, 2022
2 Years ago
;