This content originally appeared on DEV Community and was authored by Azaan Suhail
When I started learning JavaScript, I used to get super confused between let, const, and var
All three looked the same to me until I made a simple table like this
And guess what? It made everything so clear in just 2 mins!
Here’s what finally clicked for me:
- var is old-school and can be used anywhere inside a function
- let and const are modern and work only inside curly braces {}
- const is like a strict teacher – once set, can’t change
This small concept wasted a lot of my time earlier.
Hope this helps someone who’s stuck like I was
This content originally appeared on DEV Community and was authored by Azaan Suhail