Agyan
adda
Run
Reset
Copy
JavaScript Tutorial › JS Variables › let and const
Back to tutorial
Code
Edit, then press Run or Ctrl+Enter
<p id="out"></p> <script> const city = 'Gaya'; let score = 10; score = score + 5; document.getElementById('out').textContent = city + ' – score: ' + score; // city = 'Patna'; // Error: const cannot be reassigned </script>
Result