Computer >> Computer tutorials >  >> Programming >> Javascript

Number.toString() function in JavaScript


The toString() function of the Number object accepts a number and returns the string representation of the given number.

Syntax

Its Syntax is as follows

num.toString(num);

Example

<html>
<head>
   <title>JavaScript Example</title>
</head>
<body>
   <script type="text/javascript">
      var num = 215;
      result = num.toString(16);
      document.write("Result: " + result);
   </script>
</body>
</html>

Output

Result: d7