- 1
function a() {
console.log('1')
}
a()
(function () {
console.log('2')
})();
运行之后
- 2
a()
function a() {
console.log('1')
}
(function () {
console.log('2')
})();
如果这样就不会报错,当然如果把立即执行函数删除的话就不会报错。
请教下这是什么原因
加分号吧