Home / Angular / What’s the difference between “let” and “var” to declare a variable?

What’s the difference between “let” and “var” to declare a variable?

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

 

Ref: https://stackoverflow.com/questions/762011/whats-the-difference-between-using-let-and-var-to-declare-a-variable

About Mohammad Fareed

Software Engineer @ Tekzenit.

Check Also

What’s new In Angular 5? What Is the Difference Between Angular 4 and Angular 5?

Angular, one of the best open-source JavaScript frameworks for web application development, recently upgraded with …

Leave a Reply

Your email address will not be published. Required fields are marked *