javascript - Code won't run because I can't output more than one variable in document.write -


my code won't run when try display more 1 variable in document.write section of code. i'm pretty sure doing right.


<script type="text/javascript"> var name = prompt("welcome fruity store. name?",""); var product = prompt("what name of product like?",""); var price = 1*prompt("how cost?",""); var quantity = 1*prompt("how many of fruit like?",""); var discount = 1*prompt("what discount of product in decimal form?",""); var costoforder = (price*quantity); var discounted = (price*quantity*discount); var totalorder = (costoforder - discounted);  document.write("thank placing order " +name )  document.write("<p>the cost of buying " +quantity "of " +product "is " +costoforder    </p>) document.write("<p>the discount purchase " +discounted </p>) document.write("<p>with discount, total order cost " +totalorder</p>)  </script> 

you missing plus signs in string concatenation.

"<p>the cost of buying " + quantity + " of " + product + " " + etc. 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -