Global.parseInt() : parseInt « Global « JavaScript Tutorial






Syntax

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.

<html>
    <body>
    <script language="JavaScript">
    <!--
    document.write("The string 8 converted to an integer is: ");
    document.write(parseInt("8") + "<br>");
    -->
    </script>
    </body>
    </html>








8.11.parseInt
8.11.1.Global.parseInt()
8.11.2.Parse binary number
8.11.3.Parse hexidecimal string