Differences between Var, Let and Const in JavaScript

Var

Setting a Global var variable
Setting a var variable in a function

Let

Trying to redeclare a let variable
Updating a let variable
Setting let variables in two different scopes

Const

Trying to redeclare const variable
using const to define an object

Conclusion

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Restaurant Site Project with GatsbyJS-11

ReactJS Fundamentals with a Project

GSoC 2020 : Second Evaluation

4 Front-End Trends and 1 Loser

The number four inside a circle

Looper Turned Splitter, or: How I Learned to Stop Mutating and Went Functional

Turning your existing Website to PWA using pwainit

What’s the difference between React vs React Native ?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ahmed A.

Ahmed A.

More from Medium

What is Hoisting in JavaScript

Russian Doll Envelope

Node JS vs Spring Boot which one to choose and main features

CS373 Spring 2022: Anish Roy