为什么这段代码出错?

时间:2017-04-26 10:14:42

标签: javascript jquery

为什么此代码会返回错误。

 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未捕获的TypeError :(中间值)(...)不是a   函数(...)

1 个答案:

答案 0 :(得分:0)

您忘记在函数表达式之前插入;

在函数表达式consoleParse =(function(e){之后立即放置(...)     old_newOther(E);  })将使用您指定的参数调用该函数。

这就是为什么不建议使用自动分号插入的原因。始终使用;结束语句。

相关问题