JavaScript - Why isn't this working? I can't see the difference -


i'm starting out here i've got these 2 sections of js code. first block example book copied , pasted, second block 1 typed out , (in eyes) identical first block. when run code, second block (the 1 typed) doesn't work. i've looked @ each character , can't find out why.

<!doctype html> <html lang="en">     <head>         <title>chapter 2, question 2</title>     </head>     <body>         <script>             var firstnumber = parsefloat(prompt("enter first number",""));             var secondnumber = parsefloat(prompt("enter second number",""));             var thetotal = firstnumber + secondnumber;              document.write(first number + " added " + secondnumber + " equals " + thetotal);         </script>     </body> </html> 

there space in first number.

this:

document.write(first number + " added " + secondnumber + " equals " + thetotal); 

should be:

document.write(firstnumber + " added " + secondnumber + " equals " + thetotal); 

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -