JavaScript常见错误(小结)

JavaScript常见错误(小结),第1张

1、Uncaught TypeError: Cannot read property

当你读取一个未定义的对象的属性或调用其方法时,这个错误会在 Chrome 中出现。

2、 TypeError: ‘undefined' is not a function

当你调用未定义的函数时,这是 Chrome 中产生的错误。

3.Uncaught SyntaxError: Unexpected token '<'

这是比较基础的错误,这代表‘<’ 这个符号不应该存在。

4.Uncaught ReferenceError: b is not defined

这句话的意思是,b没有被定义,就被使用了

5.Uncaught SyntaxError: Invalid or unexpected token

 语法错误,当出现这句话的时候,你应该检查一下你的标点符号是否书写正确

6. Uncaught TypeError: Cannot set property

 当我们尝试访问一个未定义的变量时,它总是返回 undefined,我们不能获取或设置任何未定义的属性。 在这种情况下会将抛出 “Uncaught TypeError: Cannot set property”。

7.TypeError: Cannot read property ‘length'

 

 这是因为读取未定义变量的长度属性而发生的错误。

 8.Uncaught TypeError: Cannot read properties of null (reading 'classList')

 

 

当读取null的classList属性了发生了类型错误,classList前面那个元素为null 没有选择到

9.Uncaught TypeError: Cannot read properties of undefined

不能读取未定义的属性,add前面那个对象是undefined

10.Uncaught TypeError: Cannot read properties of null

不能读取到空属性,这代表appendChild前面的元素为null

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1320346.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-11
下一篇2022-06-11

发表评论

登录后才能评论

评论列表(0条)

    保存