August 1999
Intermediate to advanced
1488 pages
72h 53m
English
parseInt(string, radix) parseInt(string)
The parseInt() method is used to convert a string to an integer. It can take string input with an optional radix input. The radix input represents the base of the number in the string.
Listing 6.141 shows how parseInt() is used to parse a string. A few different examples are shown for different string types.
<html> <body> <script language="JavaScript"> <!–– Hide // convert the "859" string to an integer document.write("The string 859 converted to an integer is: "); document.write(parseInt("859") + "<br>"); // converts a binary ... |
Read now
Unlock full access