未捕获的类型错误: (中间值)(...) 不是函数使分号规则变得简单
当我在闭包中将js逻辑编写为单个js文件时,一切正常,例如:
(function(win){
//main logic here
win.expose1 = ....
win.expose2 = ....
})(window)
但是当我尝试在同一个js文件中的闭包之前插入日志记录替代函数时,
window.Glog = function(msg){
console.log(msg)
}
// this was added before the main closure.
(function(win){
//the former closure that contains the main javascript logic;
})(window)
它抱怨有一个TypeError:
Uncaught TypeError: (intermediate value)(...) is not a function
我做错了什么?