Number.parseInt() function in JavaScript


The parseInt() function of the Number object accepts a string, parses and returns an integer of the specified radix or base.

Syntax

Its Syntax is as follows

Number.parseInt('0xF', 16);

Example

 Live Demo

<html>
<head>
   <title>JavaScript Example</title>
</head>
<body>
   <script type="text/javascript">
      var result = Number.parseInt('0xF', 16);
      document.write(result);
   </script>
</body>
</html>

Output

15

Updated on: 25-Jun-2020

36 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements