On Tue, Jan 18, 2011 at 15:21, Peter van der Zee <[email protected]> wrote:
> It seems you are relying on hoisting. If you really want to do that you'll
> need to use so called function defintions.
>
> function callback1(){}
> vs
> var callback1 = function(){};
>
> The first is a definition, these are hoisted (parsed and constructed before
> the code is actually executed). The second is an expression, which is only
> evaluated if and when the code reaches it.
>
I have updated my fiddle and you're right, thank you.
http://jsfiddle.net/vZebx/1/
What about the scope? I am using the var's as a method of keeping the
functions from polluting the global scope.
If they pollute the global scope I won't be able to use the same naming
convention (cb1,cb2,cb3...) in my other event handlers.
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]