0

Var vs Let in Javascript

Which do you use? Why? Can you give an example to convey your point?

24th Sep 2018, 4:41 PM
Daniel
Daniel - avatar
2 odpowiedzi
+ 1
I’m by no means an expert but, seeing that you’ve a lack of answers so far, I’ll venture a response. As far as I know, let is the more modern usage and var is becoming deprecated. But, because of issues of readability with older browsers, some programmers keep using var to cater for all browsers. There are a few differences with behaviour too, but I can’t remember what.
24th Sep 2018, 6:56 PM
Russ
Russ - avatar
0
Var is not going to be deprecated. Var define global scope variables while in another hand, Let define "Block, expressions, functions" variables. However, Let is not hoisting.
24th Dec 2018, 7:07 AM
Francis Fulgencio
Francis Fulgencio - avatar