Introduction to javascript special usage examples


Grammar:


function sayWhat(msg){
alert(msg);
}
sayWhat(" hello ");

Equivalent to the following syntax (js closure (anonymous self-executing function) syntax) :


(function(msg){
alert(msg);
})(" hello ");