Working with var, let, const, and block scopes

Share this video with your friends

Send Tweet

{} is overloaded to be either an object literal or a block scope. When an assignment is made to a variable inside of the {}, it then becomes a block scope. Otherwise it is treated as an object literal.

var, let, and const respect block and function scopes differently. var is also hoisted and can be redeclare while that is not true for let and const. This lesson goes more in depth on scope and how each variable declaration treats it differently.

Brad Rice
Brad Rice
~ 5 years ago

What extension do you use to show the console.log value at the end of the code line?

Tyler Clark
Tyler Clark(instructor)
~ 5 years ago

I use the pro version of this: https://quokkajs.com/docs/index.html