I have not seen this type of grammar before. What does it mean? What technique does this apply to?
(function(fun) { })(myFunkyAlert);
This is an anonymous function that will run immediately after the announcement. Its parameter is myFunkyAlert , and inside the function it will be referenced as a fun variable.
myFunkyAlert
fun
The reason we usually write such a function is to avoid conflicts due to visibility.
Example:
var myFunkyAlert = "The funky alert"; (function(fun) { alert(fun); })(myFunkyAlert);
This will result in a warning with the message "Frightened warning."
You define an anonymous function and then call it with myFunkyAlert as an argument.
Check out this question: What is the difference between a vs declaration function expression in JavaScript? and this link: http://kangax.github.com/nfe/