Skip to content

Latest commit

 

History

History
30 lines (19 loc) · 1.06 KB

constant.md

File metadata and controls

30 lines (19 loc) · 1.06 KB

🔓 Constant

In situation where we don't want the value of a variable to be changed, we can use constant instead of variable.

const birthMonth = 10;
console.log(birthMonth);

ℹ️ We are not allowed to change the value of a constant.


Let's try doing it and see what will happen.

If i were to change the birthMonth to 11,

let birthMonth = 11;

I will get an error message on my console,





◀️ Previous Page : Basics of JavaScript : Variables 🔓                            🏡                        ▶️ Next Page : Basics of JavaScript : Primitive Types 🔓