variable access

2 moment(s) that assert this concept — showing 1–2 of 2

single sourceRests on a single channel — treat as a lead, verify independently
↣ how this spread over time →
provenance — click a node to open its encoding unit
[1] Google[2] Google
showing 2 of 2 moments
Google TechTalks · youtube · en
1When a function executes, identifier resolution searches the scope chain from front to back, starting with the activation object and progressing to the global scope, and if a variable is not found, an error is thrown.
“And what happens is when the function is being executed and it comes across a variable this process of identifier resolution starts. And it starts by looking at the first spot in the scope chain and then makes its way down to the back. So, if it finds it in the first place, awesome, that's what it uses. If it's not found then it goes on to the next place in the scope chain and so on and so forth until either it's found or it's not found and then you end up getting an error.”
spoken · 462s · 2009-06-05
Google TechTalks · youtube · en
2The with statement temporarily adds an object to the front of the scope chain, pushing local variables into the first slot and increasing resolution time.
“As soon as execution flows into the with statement, you end up with a scope chain that looks like this. There's a variable object that's pushed to the front. So, now that has all of your with block variables and that means that all of the local variables to your function are now one step away in the scope chain and that will affect your performance.”
spoken · 586s · 2009-06-05