... and you do not know how to reuse functions ... Daniel, dunno why this
answer, setTimeout works "like that" before you started to write javascript,
it has always been like that, only IE and some Opera did not get it.
function myReusableFunction(arg1, arg2){
// do your stuff, reuse the function if necessary, avoid useless
closures and redundant code
};
setTimeout(myReusableFunction, 1000, "a", {b:"c"});
Tell me a single reason I should write every time a new function, slower,
with a new closure, slower, to call an already defined function.
setTimeout(function(){
myReusableFunction("a", {b:"c"})
}, 1000);
Now, rather than this, think about setInterval, and make your knowledge
about ECMAScript deeper.
Thanks
On Tue, Jul 7, 2009 at 5:41 PM, Daniel Friesen <[email protected]>wrote:
>
> As for setTimeout, it has no need for extra arguments. If you think you
> need extra arguments to setTimeout, then you don't know how to use one
> of JavaScript's core features, closures.
>
> ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---