Javascript inline global parameter not updating

What if we pass that function to something other than set Timeout?

If the name is not specified then it is "anonymous". If the function is being used in exactly one place and has no relevance anywhere else then I would use a function expression unless it is prohibitively long or otherwise feels out of place (for style reasons).

I've seen function refs nested in function refs as the developer realized that more callbacks were needed in subsequent steps.

Instead of this tree based logic, I prefer the organization of isolated functions.

I define it outside of a function and I want to change the global variable value from inside a function and use it from another function, how do I do this?

Just reference the variable inside the function; no magic, just use it's name.

Leave a Reply