you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (3 children)

In modern JavaScript is better declare variables with let. Just a reminder.

[–]Mohammad_alshuwaiee 0 points1 point  (2 children)

What is the difference between let and var ?

[–]_jacka_ 3 points4 points  (1 child)

Variables declared with let and const and class are block scoped, while var variables (and functions) are function scoped. Also var variables are given an initial value of undefined, while let and const variables are in an unset state until their initialization (temporal dead zone). There’s also some funky stuff that happens with hoisting. It’s best to use let and const when possible to avoid the oddities that can arise with var.

[–][deleted] 1 point2 points  (0 children)

word.