CarisL / noteBook

平时自己学习的过程中的积累
0 stars 0 forks source link

[JS]最常见的 Javascript 错误 #5

Open CarisL opened 6 years ago

CarisL commented 6 years ago

1.Uncaught TypeError: Cannot read property 最佳就是构建函数默认值

  1. TypeError: ‘undefined’ is not an object 这是在 Safari 中读取属性或调用未定义对象上的方法时发生的错误。您可以在 Safari Developer Console 中轻松测试 3.TypeError: null is not an object 这是在 Safari 中读取属性或调用空对象上的方法时发生的错误。 您可以在 Safari Developer Console 中轻松测试。 在 JavaScript 中,null 和 undefined 是不一样的,这就是为什么我们看到两个不同的错误信息。undefined 通常是一个尚未分配的变量,而 null 表示该值为空。 要验证它们不相等,请尝试使用严格的相等运算符 ===:
  2. TypeError: Object doesn’t support property
  3. TypeError: ‘undefined’ is not a function
  4. Uncaught RangeError: Maximum call stack 这是 Chrome 在一些情况下会发生的错误。 一个是当你调用一个不终止的递归函数。您可以在 Chrome 开发者控制台中进行测试。 7.TypeError: Cannot read property ‘length’ 这是 Chrome 中发生的错误,因为读取未定义变量的长度属性。 您可以在 Chrome 开发者控制台中进行测试。
  5. Uncaught TypeError: Cannot set property 当我们尝试访问一个未定义的变量时,它总是返回 undefined,我们不能获取或设置任何未定义的属性。 在这种情况下,应用程序将抛出 “Uncaught TypeError: Cannot set property”。

来自公众号:https://mp.weixin.qq.com/s?__biz=MjM5MTA1MjAxMQ==&mid=2651227829&idx=1&sn=b4ae3261e63665a7bc0c24fb5dc8fe99&chksm=bd495f318a3ed6272d0e9766d38a3543f85796c723a9b7156d670f9c6942c0a2e1a0fbbd3e7f&scene=21#wechat_redirect