Feedback on post?

Been reading LtU for a while and some of the topics discussed have encouraged me to try using some of the more advanced functions supported by JavaScript. I'm pretty sure I'm using closures, but had a few questions-

js closures? my questions are:

If the form is:

someId = window.setInterval( ... ); there a way to pass someId back into the function that was created? In OO terms, something like the following:

closure = new SomeThingy();
someId = window.setInterval( closure, 1000 );
closure.setSomeExtraValue( someId );

...and is the explanation in the blog post fairly accurate?



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

You cannot pass back, but

You don't have to pass a value back. The function can access all variables from the parent scope, even if a variable is created after the closure. For example:

var closure = function()
var someId = window.setInterval(closure, 1000);