Edit This Code:
See Result »
<
!DOCTYPE
html
>
<
html
>
<
body
>
<
h1
>
JavaScript Variables
<
/h1
>
<
p
id
="demo"
>
<
/p
>
<
script
>
var
price1 =
5
;
var
price2 =
6
;
var
total = price1 + price2;
document.getElementById(
"demo"
).innerHTML =
"The total is: "
+ total;
<
/script
>
<
/body
>
<
/html
>
<!DOCTYPE html> <html> <body> <h1>JavaScript Variables</h1> <p id="demo"></p> <script> var price1 = 5; var price2 = 6; var total = price1 + price2; document.getElementById("demo").innerHTML = "The total is: " + total; </script> </body> </html>
Result:
Privacy Policy