Edit This Code:
See Result »
<!DOCTYPE html> <html> <body> <p>Click the button to return the value of the string object.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { var str = "Hello World!"; var res = str.toString(); document.getElementById("demo").innerHTML = res; } </script> </body> </html>
Result: