Edit This Code:
See Result »
<
!DOCTYPE
html
>
<
html
>
<
body
>
<
h1
>
JavaScript Variables
<
/h1
>
<
p
>
Add "John" + " " + "Doe":
<
/p
>
<
p
id
="demo"
>
<
/p
>
<
script
>
var
x =
"John"
+
" "
+
"Doe"
;
document.getElementById(
"demo"
).innerHTML = x;
<
/script
>
<
/body
>
<
/html
>
<!DOCTYPE html> <html> <body> <h1>JavaScript Variables</h1> <p>Add "John" + " " + "Doe":</p> <p id="demo"></p> <script> var x = "John" + " " + "Doe"; document.getElementById("demo").innerHTML = x; </script> </body> </html>
Result:
Privacy Policy