클로저에 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
내가 뭘 잘못 했어?