Prev Demo
JavaScript
>
Objects To Strings
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <p>Click the button to convert objects to strings.</p> <button onclick="myConvert()">Try it</button> <p id="demo"></p> <script> function myConvert() { var a = 8520; var b = "8520"; var c = new Date(); var d = Boolean(1); var e = Boolean(2); var r = String(a) + "<br>" + String(b) + "<br>" + String(c) + "<br>" + String(d) + "<br>" + String(e); document.getElementById("demo").innerHTML = r; } </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output