The sample javascript self invoking function is defined as follows
(function(parmeter1){
alert(parameter1);
}("hello world");
Notice the data in the last parentices is the actual caller that will invoke the function, which passes the argument's value as "hello world".
Inside the function definition, the parameter1 is replaced by the string "hello world", and shows the alert.
(function(parmeter1){
alert(parameter1);
}("hello world");
Notice the data in the last parentices is the actual caller that will invoke the function, which passes the argument's value as "hello world".
Inside the function definition, the parameter1 is replaced by the string "hello world", and shows the alert.
No comments:
Post a Comment