Firefox 从 setInterval 里查找 jQuery 的方法为 undefined, Chrome 却正常?

下面的代码... 写了两份:

test = ->
  console.log (typeof $.ajax)
  console.log (typeof $('body').find)

ttest = setInterval test, 1000
test = function() {
  console.log(typeof $.ajax);
  return console.log(typeof $('body').find);
};

ttest = setInterval(test, 1000);

Firefox 下持续输出 undefined, Chrome 下持续输出 function, 这是为什么?

阅读 9.3k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题