Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
20
rated 0 times [  27] [ 7]  / answers: 1 / hits: 16378  / 14 Years ago, sat, january 8, 2011, 12:00:00

When used with numbers, the toString() method converts a number into a string representation using the base numbering system specified by the optional radix.



For instance the number 8 and toString(2) would return 1000.



Is there a method to achieve the opposite? I.e., convert the string 1000 back into the number 8?


More From » tostring

 Answers
12

parseInt() takes a radix as its second argument, so you can do parseInt(1000, 2) to get what you want.


[#94324] Thursday, January 6, 2011, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
quentinaveryb

Total Points: 102
Total Questions: 100
Total Answers: 93

Location: Colombia
Member since Mon, May 2, 2022
2 Years ago
quentinaveryb questions
Thu, Aug 6, 20, 00:00, 4 Years ago
Fri, Jul 17, 20, 00:00, 4 Years ago
Mon, Aug 12, 19, 00:00, 5 Years ago
;