Agyan
adda
Run
Reset
Copy
JavaScript Tutorial › JS Syntax and Comments › Statements and comments
Back to tutorial
Code
Edit, then press Run or Ctrl+Enter
<p id="out"></p> <script> // Price of one item let price = 250; let qty = 4; // number of items /* Calculate the total and show it on the page */ let total = price * qty; document.getElementById('out').textContent = 'Total: ₹' + total; </script>
Result