/ Published in: JavaScript
I don’t know how or why this works.
Expand |
Embed | Plain Text
setTimeout({ run: function() { foo(bar) } }.run, 1000);
Comments
Subscribe to comments
You need to login to post a comment.

That's pretty.
Picture declaring your object with the "run" method before line 1.
var obj1 = { run: function() { foo(bar); } } setTimeout(obj1.run, 1000);
It's really no different. From the look of it, it appears the object is "anonymous," given your demonstration.