Use parseInt() to convert hexadecimal format value to integer in JavaScript

Description

The following code shows how to use parseInt() to convert hexadecimal format value to integer.

Example


<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
document.writeln(parseInt("0xA"));
</script><!--from   www . j  a  va2 s .  c  om-->
</head>
<body>
</body>
</html>

Click to view the demo

The code above generates the following result.

Use parseInt() to convert hexadecimal format value to integer in JavaScript
Home »
  Javascript Tutorial »
    Data Type »
      Number parseInt
Javascript Tutorial Number parseInt
Convert "123asdf" to integer with parseInt(...
Convert "asdf123" to integer with parseInt(...
Convert empty string("") to integer with pa...
Convert one value to int with different rad...
Convert string to create an integer value w...
Covert value to int with radix in JavaScrip...
Covert value without 0x to int with radix 1...
Use parseInt() to convert float point value...
Use parseInt() to convert hexadecimal forma...
Use parseInt() to convert octal format valu...