var, let & const in JavaScript.
Detailed Explanation:
Thread 🧵
Detailed Explanation:
Thread 🧵
📌JavaScript Variables:-
A variable is a container (storage area) to hold data.
# Four Ways to Declare a JavaScript Variable:
- Using `var`
- Using `let`
- Using `const`
JavaScript Variables:
A variable is a container (storage area) to hold data.
# Four Ways to Declare a JavaScript Variable:
- Using `var`
- Using `let`
- Using `const`
JavaScript Variables:
📌Const:-
Once a constant is initialized, we cannot change its value.
eg:-
`const x = 5;`
Once a constant is initialized, we cannot change its value.
const x = 5;
x = 10; // Error!
console.log(x) Simply, a constant is a type of variable whose value cannot be changed.
Once a constant is initialized, we cannot change its value.
eg:-
`const x = 5;`
Once a constant is initialized, we cannot change its value.
const x = 5;
x = 10; // Error!
console.log(x) Simply, a constant is a type of variable whose value cannot be changed.
If you enjoyed reading this thread, please do the following:
1. Like the thread❤️
2. Retweet the first tweet.🔃
3. Follow me and enable notifications: ✅
@CodeMarch
Thank you for reading all the way through.
1. Like the thread❤️
2. Retweet the first tweet.🔃
3. Follow me and enable notifications: ✅
@CodeMarch
Thank you for reading all the way through.
Loading suggestions...