ES2015(ES6) was released long back and one of the features that came with ES6 is the addition of let and const, another way for variable declaratio...
For further actions, you may consider blocking this person and/or reporting abuse
i just googled it and it says something like this and i am kind of confused now🤔🤔🤔
The main difference between let and var is that scope of a variable defined with let is limited to the block in which it is declared while variable declared with var has the global scope. So we can say that var is rather a keyword which defines a variable globally regardless of block scope.
Yes, that what I wrote above. Yes, let has block scope and var has functional scope. You are mixing two things here and that is what confusing you. Whenever any variables declared outside function, outside blocks in globally - either be let or var, it will have full global scope
ok than you very much 👍👍
Always welcome buddy :)
Good post!
Glad you liked it, Please do share with your connections as well
thank you for this ,it clears my confusion as i'm a newbie.
Thanks a lot. Glad you liked it. Js is all easy, you can start with some.good tutorials online, things will be good.
Simple and clear
Glad you liked it, Please do share with your devlopers friends and community
Main problem with var is the concept of 'hoisting'. It is better to stick with const and let.
More on w3schools.com/js/js_hoisting.asp
I really appreciate it. Hoisting is a seprate concepts in JavaScript related to the var keyword. I didn't put that in the article here. But was expecting some discussion on this :). Will definitely talk about it on next article. Glad you read it. Let and const are additions but they are the best for variables declaration in js due to these certain side effects