Strings to Integers

Enter your purchase details.


Code Example

 <script>
  var dollarAmount = prompt("How much did you pay for that Jacket?", "79.99");
  var tax = dollarAmount * .095;
  var total = parseFloat(dollarAmount) + parseFloat(tax);
  alert("Including tax, the total amount due for your jacket is $" + total.toFixed(2));
  document.write("Jacket: $" + dollarAmount + "<br>");
  document.write("Tax @ 9.5% $" + tax.toFixed(2) + "<br>");
  document.write("Total: $" + total.toFixed(2) + "<br>");
  document.write("<br><br>Including tax, the total amount due for your jacket is $" + total.toFixed(2));
 </script>