Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript Convert Values to Strings</title> </head> <body> <script> document.write(String(10.5) + "<br>"); // Prints: "10.5" document.write(String(123) + "<br>"); // Prints: "123" document.write(String(100 + 23) + "<br>"); // Prints: "123" document.write(String(true) + "<br>"); // Prints: "true" document.write(String(false) + "<br>"); // Prints: "false" document.write(String(123e-1) + "<br>"); // Prints: "12.3" document.write(String(0xFF) + "<br>"); // Prints: "255" document.write(String(undefined) + "<br>"); // Prints: "undefined" document.write(String(null)); // Prints: "null" </script> </body> </html>