今日学习之常见的内置错误(js)

1,常见的内置错误

ReferenceError:引用的变量不存在
// console.log(a) //ReferenceError:a is not defined
// console.log('------') //没有捕获error,下面的代码不会执行

TypeError:数据类型不正确的错误
// let b
// console.log(b.xxx) //TypeError:Cannot read propery 'xxx' of underfined
//b={}
//b.xxx() //TypeError: b.xx is not a function

RengeError: 数据值不在其所允许的范围内
// function fn(){
// fn()
// }
// fn() //RangeError:Maximum call stack size exceeded

SyntaxError:语法错误
// const c="""" //SyntaxError:Unexpected string

posted @ 2020-12-28 09:21  Abel°  阅读(111)  评论(0)    收藏  举报