The @v8js engine optimizes away the `outerValue` from the closure for `inner`, since it's no needed. So @ChromeDevTools has no way to get to its value.
-
-
initially that was my idea, but it still wasn't available in the inner, when it is used after it. function onLoad() { const oValue = 'ipsum'; function inner() { var innerVaue = 'test test'; debugger; } inner(); console.log(Value); }
0 proslijeđenih tweetova 0 korisnika označava da im se sviđa -
Odgovor korisnicima @CongoCart @bmeurer i sljedećem broju korisnika:
Lol, last line should be `console.log(oValue);` so shouldn't oValue still be available since it has to be used AFTER inner() is called?
1 reply 0 proslijeđenih tweetova 0 korisnika označava da im se sviđa -
Odgovor korisnicima @CongoCart @v8js i sljedećem broju korisnika:
cc
@tverwaes1 reply 0 proslijeđenih tweetova 0 korisnika označava da im se sviđa -
Odgovor korisnicima @bmeurer @CongoCart i sljedećem broju korisnika:
No, oValue is referenced from the function itself so is still not context allocated. Only gets context allocated if an inner function references it (or if there's an eval).
0 proslijeđenih tweetova 0 korisnika označava da im se sviđa -
Seems strange to me that oValue is not known by the debugger at that point since it is still allocated; and in the parent scope. This creates a bit of debugging pain when you are dealing with Lamda's and things like .map, .reduce, etc.
1 reply 0 proslijeđenih tweetova 0 korisnika označava da im se sviđa -
Odgovor korisnicima @CongoCart @tverwaes i sljedećem broju korisnika:
The v8 engine knows what the value is; but the debugger doesn't. In this example; eval got the value and returned it -- but while in inner() the debugger still has no clue.pic.twitter.com/CXsF46Uuen
0 proslijeđenih tweetova 0 korisnika označava da im se sviđa -
Odgovor korisnicima @CongoCart @tverwaes i sljedećem broju korisnika:
So would this be something you think a feature request to enhance the tooling to change it to work the way a developer would assume it would work. (i.e. child scopes can see parent scope values, just like code can. )
1 reply 0 proslijeđenih tweetova 1 korisnik označava da mu se sviđa -
Odgovor korisnicima @CongoCart @bmeurer i sljedećem broju korisnika:
In general this doesn't work ("onLoad" can finish and destroy "oValue" before "inner" is called), but I agree that it may make sense to provide access to values when they are still available; especially for .map etc.
@hashseed0 proslijeđenih tweetova 0 korisnika označava da im se sviđa -
Odgovor korisnicima @tverwaes @CongoCart i sljedećem broju korisnika:
Pro-tip: if the function is still on the stack, select the stack frame to see the stack locals.pic.twitter.com/yiBARGCUZ7
9 proslijeđenih tweetova 29 korisnika označava da im se sviđa
Awesome pro-tip. 
Čini se da učitavanje traje već neko vrijeme.
Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.