+ 4
Can someone explain the difference between var let const in Javascript
4 Answers
+ 8
var and let creates variables which value can be changed. The difference between var and let is that let doesn't support variable hoisting while var does.
Hoisting means you can use the variable before the variable declaration.
const creates a variable which value cannot be changed.
Blocked-scoped means you can access the variable in the block it was declared.
+ 5
Here's a nice and beginner friendly explanation.
https://www.youtube.com/watch?v=q8SHaDQdul0
Also, watch some of his other videos about topics of ES6, it will likely help you along the way.
+ 3
It's a new kind of syntax launched with es6+ in javascript. Past es6, we were supposed to use var which didn't say much about constants and variables. So now a new notion is that you use const for constants and you can't change that value throughout the course of your programme execution. let basically assigns a variable whose values change frequently. Const is assigned a value by the user while declaration. If you try to assign a new value, Javascript throws an error!
+ 2
Here you go buddy:
https://dev.to/sarah_chima/var-let-and-const--whats-the-difference-69e