What does this construct mean?
var digits = [1, 2, 3];
(function fetchData(name){
//body
})(digits.shift());
which construct?
I can explain what's happening, if that will help:
(in the order of execution)
That syntax is used to prevent identifiers from leaking into the containing namespace.
After that code, if you attempt to call fetchData(name)
you will find that fetchData
is undefined, thanks to the () wrapper.
Declare a function and call it.
Click on this http://jsfiddle.net/TC8K6/ you will see a alert of the parameter passed to the function.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.