Articles → JAVASCRIPT → Const Keywords In Javascript
Const Keywords In Javascript
Purpose
- You cannot redeclare the const variable.
- You cannot reassign the value of the const variable
- You must assign the value to the constant at the time of declaration.
Example
<script>
const pi = 3.14;
// This code will give error
pi = 3.1416;
const pi2;
// This code will give error
pi2 = 3.1416;
</script>
Try It
Posted By - | Karan Gupta |
|
Posted On - | Wednesday, July 28, 2021 |