Test name | Executions per second |
---|---|
instanceof | 69844.6 Ops/sec |
prop test | 71144.2 Ops/sec |
class NewError extends Error {
constructor() {
super()
this.customProp = 'blah'
}
customProp
}
const testErr = new NewError()
testErr instanceof NewError
class NewError extends Error {
constructor() {
super()
this.customProp = 'blah'
}
customProp
}
const testErr = new NewError()
!!testErr && typeof testErr === 'object' && 'customProp' in testErr