prompt jumped only for the first time- javascript -


i have pretty easy assignment doesnt work. prompt jumped first time , nothing work anymore. appreciate help! thank you

assignment : shopkeeper gives discount of 10 percent when customer buys more 1000 items. 1. write function take total item purchased(prompt) , price per item(fixed) parameters.and calculate total amount payable customer.

<!doctype html> <html> <head>     <meta charset="utf-8">     <script src = "8.js"></script> </head> <body>     <button onclick="check()">check</button> </body> </html>      function check(){    var totalitem = parseint(prompt('please enter total item purchased:')); var priceperitem = 15.5;      if (totalitem > 1000){         function  topay(totalitem, priceperitem){         var topay = (totalitem * priceperitem) * 0.9;         console.log(topay);         document.write ('total amount payable ' + topay);             };         }  }; 

use this

function  topay(totalitem, priceperitem){         var topay = (totalitem * priceperitem) * 0.9;         console.log(topay);         document.write ('total amount payable ' + topay);             };         topay(totalitem, priceperitem);         } 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -