Immediate function invocation syntax

From Douglass Crockford’s style convention guide: (search for “invoked immediately”)

When a function is to be invoked immediately, the entire invocation expression should be wrapped in parens so that it is clear that the value being produced is the result of the function and not the function itself.

So, basically, he feels it makes more clear the distinction between function values, and the values of functions. So, it’s an stylistic matter, not really a substantive difference in the code itself.

updated reference, old PPT no longer exists

Leave a Comment