2017-04-26 78 views
-1

爲什麼此代碼返回錯誤。爲什麼在此代碼中出現錯誤?

var old_newOther = newOther; 
consoleParse = function(e){ 
    old_newOther(e); 
} 
(function($) { 
newOther = function(e){ 
    for(var k in e){ 
    if(isset(e[k].onMouseDown)){ 
     TalkWithNPC(e[k].id); 
    } 
    } 
    return e; 
}})(jQuery); 

VM413:29 Uncaught TypeError: (intermediate value)(...) is not a function(…)

回答

0

你忘了之前的函數表達式地內陷式;

配售(...)函數表達式consoleParse =後立即(功能(E){ old_newOther(E); })將調用函數與您指定的參數。

這就是爲什麼不建議使用自動分號插入的原因。始終以;結束您的陳述。

+0

這是相同的問題,在 http://stackoverflow.com/questions/36278393/typeerror-intermediate-value-is-undefined –

相關問題