var obj = { name:'nan'}obj.fun = function(){ console.log(1)} (function(){ console.log(2)})()
这样会输出
1VM29719:6 Uncaught TypeError: (intermediate value)(...) is not a function
因为没有在定义obj.fun时添加分号,导致
obj.fun = function(){ console.log(1)}(function(){console.log(2)})
定义时直接执行一次,后面的括号导致报错