In higher development, especially real world jobs. We don't use var at all. In fact, it's a buzz word when you come to interview and use var instead of let and const. I reccommend remove var completely when you have learned ES6. Just because It's a industry standard already.
Like I join the interview with my head of engineering one time to interview a girl. And she is not very familiar with javascript and use var instead of let and const like it's a BUZZ right away there. Eventually we didn't fail her because she use var but we did fail her because her lacking of understanding of javacsript.
Agreed, in my experience as well using let makes sense almost all of the time.
There is only one case in favor of var i.e. to use it when you intentionally want to make a variable scoped to the function instead of any block( better done with let if you ask me)
Still, the purpose of article is to provide a comprehensive view of what all is possible in JS and more importantly tell what are the implications of using each one here.
And as you pointed out it being a buzz word for interview, can lead to some tricky questions, around using var with closures - so always good to have an understanding about how it behaves and why it does so.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
In higher development, especially real world jobs. We don't use
varat all. In fact, it's a buzz word when you come to interview and usevarinstead ofletandconst. I reccommend removevarcompletely when you have learned ES6. Just because It's a industry standard already.Like I join the interview with my head of engineering one time to interview a girl. And she is not very familiar with javascript and use
varinstead ofletandconstlike it's a BUZZ right away there. Eventually we didn't fail her because she usevarbut we did fail her because her lacking of understanding of javacsript.Agreed, in my experience as well using
letmakes sense almost all of the time.There is only one case in favor of
vari.e. to use it when you intentionally want to make a variable scoped to the function instead of any block( better done with let if you ask me)Still, the purpose of article is to provide a comprehensive view of what all is possible in JS and more importantly tell what are the implications of using each one here.
And as you pointed out it being a buzz word for interview, can lead to some tricky questions, around using
varwithclosures- so always good to have an understanding about how it behaves and why it does so.