Exercise:
Concatenate the two strings to display "Hello World!".
Hint
Hint: Use the addition operator (+).
Edit This Code:
See Result »
<!DOCTYPE html> <html> <body> <p id="demo">Display the result here.</p> <script> var str1 = "Hello "; var str2 = "World!"; </script> </body> </html>
Result:
Show Answer
Correct Code:
<!DOCTYPE html> <html> <body> <p id="demo">Display the result here.</p> <script> var str1 = "Hello "; var str2 = "World!"; document.getElementById("demo").innerHTML = str1 + str2; </script> </body> </html>
Correct Result:
Hide Answer
Privacy Policy