Programming Tip Of The Day #3: Difference Between VAR and LET in JavaScript in Hindi

2,231 views · Published 18 June 2018 · 12:19 · Indexed 19 November 2026

Channel: Thapa Technical · 2018 · Education

Watch on YouTube

Welcome all, we will see Difference Between VAR and LET in JavaScript in Hindi. Difference between var, let and const in javascript.

The difference is scoping. var is scoped to the nearest function block and let is scoped to the nearest enclosing block, which can be smaller than a function block. Both are global if outside any block.

Also, variables declared with let are not accessible before they are declared in their enclosing block. As seen in the demo, this will throw a ReferenceError exception.

There are some subtle differences -- let scoping behaves more like variable scoping does in more or less any other languages.

e.g. It scopes to the enclosing block, They don't exist before they're declared, etc.

However it's worth noting that let is only a part of newer Javascript implementations and has varying degrees of browser support.

Guys, Please support my channel by SUBSCRIBE to my channel and share my videos in your Social Network TimeLines.

Don't Forget to Follow  me on all Social Network, 
 
Instagram Link:     https://www.instagram.com/vinodthapa55
Facebook Link:     https://www.facebook.com/vinodthapa55
Twitter       Link:     https://twitter.com/vb55thapa
Facebook ThapaTechnical Page Link: https://www.facebook.com/vinodbahadurthapa

More from this channel