Talk:Immediately invoked function expression
Appearance
Note that code samples from Alman's page are licensed under the GPL and so may be used with attribution.
This code snippet is incorrect:
var v, getValue;
v = 1;
getValue = (function(v) {
return v;
}(v));
v = 2;
getValue(); // 1
`getValue` is the number 1, not a function. 88.90.244.215 (talk) 19:40, 3 April 2013 (UTC) Later yo
Parentheses
The Usage section says: a common convention is to enclose both the function expression and invocation in parentheses but the following example (the one with the parameters) does not follow this convention (the invocation is not enclosed).
I changed that example in order to have both expression and invocation enclosed in parentheses. --Mariana de El Mondongo (talk) 00:28, 24 February 2015 (UTC)