次のように、クロージャー内の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
何を間違えたのですか?