美文网首页工作生活
es6报错信息总结

es6报错信息总结

作者: 刘叶青 | 来源:发表于2019-07-04 10:50 被阅读0次

报错信息:ReferenceError: can't access lexical declaration `a' before initialization

图片.png

报错原因:用let声明的变量,必须在声明之后获取这个变量,不能在声明之前就去获取这个变量

报错信息:TypeError: invalid assignment to const `a'

图片.png

报错原因:a是const定义的,是一个常量,所以不能修改const的值

报错信息:TypeError: add is not a constructor

图片.png

报错原因:箭头函数不能作为构造函数

相关文章

网友评论

    本文标题:es6报错信息总结

    本文链接:https://www.haomeiwen.com/subject/jbllhctx.html