toString Number JavaScript JS

The JavaScript number toString() method is used to get a number in the form of a string.

Syntax:

Number.toString(radix)

Parameters radix: It represents the number format. Its value can be between 2 to 36. e.g. If the value is 2 then the number format will be binary.

Returns String representation of the specified number.

Example:

<!DOCTYPE html>
<html>
<body>
<script>
var n= 12.334;
document.writeln(n.toString(2));
</script>
</body>
</html>
Please follow and like us:
Content Protection by DMCA.com