Why does debuggers give you “undefined is not a function” instead of just telling you the name of the property/variable that is not a function?

笑着哭i 提交于 2019-12-11 13:43:03

问题


What is the reason js debuggers gives you "undefined is not a function" instead of just telling you the name of the property/variable that is not a function?

example:

a = {
  aFunction: function(){...}
  notAFunction: "foo"
}

a.notAFunction()

Gives:

undefined is not a function

This is more helpful:

property "notAFunction" of object "a" is not a function

What are the exact obstacles?


回答1:


This is going to be changing very soon, it might already be in Canary too.

Improved exception messages: https://plus.google.com/+AddyOsmani/posts/DdWkiKsvbA2



来源:https://stackoverflow.com/questions/28612341/why-does-debuggers-give-you-undefined-is-not-a-function-instead-of-just-tellin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!