Ajay Yadav
Ajay Yadav

@ATechAjay

8 Tweets 20 reads Apr 08, 2022
πŸ’› Day 9️⃣ / 3️⃣0️⃣ days of basics in JavaScript series
β†’ What is var, let, and const keyword in JS?
β†’ What is the difference between var, let, and const keywords in JavaScript?
#javascript30
Let me explain!πŸ§΅πŸ‘‡
πŸ“Œ In JavaScript, developers can declare a variable using 3 keywords.
1️⃣ var
2️⃣ let
3️⃣ const
1️⃣ var (oldest way)
β†’ It is the oldest way to declare a variable.
β†’ Using the var keyword we can re-assign the value to the variable.
β†’ Declaring a variable name with the same name is also allowed.
β†’ The scope of the var keyword is global/function scope.
β›”More in next🧡
2️⃣ let
β†’ Re-assigning is allowed.
β†’ But, declaring a variable with the same name is not allowed.
β†’ The scope of the let keyword is block scope.
β›” More about on scope in the upcoming 🧡
3️⃣ const
β†’ Re-assigning is not allowed.
β†’ Declaring a variable name with the same is also not allowed.
β†’ The scope of the let keyword is also block scope.
β›” More about on scope in the upcoming 🧡
πŸ“ŒAccess previous threads from this Twitter moment.
πŸ’š That's all for now, we will meet in the next thread!
But if you like make sure to:
1. Follow me @ATechAjay
2. Retweet the first tweet.
3. Turn on the notification to never miss these amazing tweets.
Thank you so much for staying to the end of this thread.

Loading suggestions...