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> |
Output
1100.010101011000000100000110001001001101110100101111 |
Please Share