var name = {n:1}
(function(name){
})(name);
console.log(name.n);
此时报错 (intermediate value) is not a function;
解决方案:
var name = {n:1};//这里加分号
(function(name){
})(name);
console.log(name.n);
--------分割线---------------------------
var name = {n:1};
function(){
}//这里可以不用加分号
(function(name){
})(name);
console.log(name.n);