The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Advanced Function Scope

Advanced Function Scope

7:06
Function scope and closures in JavaScript can be tricky. This lesson builds on the [Function Scope Basics](https://egghead.io/lessons/core-javascript-function-scope-basics) video to dive deeper into JS function scope.
Watch this lesson now
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?