This lesson is for PRO members.

Unlock this lesson NOW!
Already subscribed? sign in

Advanced Function Scope

7:06 JavaScript lesson by

Function scope and closures in JavaScript can be tricky. This lesson builds on the Function Scope Basics video to dive deeper into JS function scope.


egghead.io comment guidelines

Avatar
egghead.io

Function scope and closures in JavaScript can be tricky. This lesson builds on the Function Scope Basics video to dive deeper into JS function scope.

Avatar
Mattias

While this video is about scopes, I feel it's a bit unfortunate that the example uses a for..in loop to iterate over an array, which is considered bad practise for several reasons.

In reply to egghead.io
Avatar
Gregor

I agree. For..in is used to iterate through properties of an object. However, since everything is an object in JavaScript (well almost everything), this is not wrong per se. But a .forEach or standard for would be much better.

In reply to Mattias
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?