try {
throw new TypeError('Hello', "someFile.js", 10)
} catch (e) {
console.log(e instanceof TypeError) // true
console.log(e.message) // "Hello"
console.log(e.name) // "TypeError"
console.log(e.fileName) // "someFile.js"
console.log(e.lineNumber) // 10
console.log(e.columnNumber) // 0
console.log(e.stack) // "@Scratchpad/2:2:9
"
}
try {
null.f()
} catch (e) {
console.log(e instanceof TypeError)
console.log(e.message)
console.log(e.name)
console.log(e.fileName)
console.log(e.lineNumber)
console.log(e.columnNumber)
console.log(e.stack)
}
try {
null.f()
} catch (e) {
console.log(e instanceof TypeError)
console.log(e.message)
console.log(e.name)
console.log(e.fileName)
console.log(e.lineNumber)
console.log(e.columnNumber)
console.log(e.stack)
}
0
//Occurs when trying to use a value in an invalid way.
1();
/*The numeric value 1 is not a function, so trying to use it as one
results in TypeError: 1 is not a function.*/