Calling instanceof on an object with as argument an arrow function generates an error. I know this particular kind of check is useless, but a library I'm using does this check on functions passed to the library.
I would expect a return value of false as result of this instanceof call with arrow functions.
Example code:
> [] instanceof (()=>{})
TypeError: Function has non-object prototype 'undefined' in instanceof check
at Function.[Symbol.hasInstance] (<anonymous>)
at repl:1:4
at ContextifyScript.Script.runInThisContext (vm.js:23:33)
at REPLServer.defaultEval (repl.js:339:29)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.onLine (repl.js:536:10)
at emitOne (events.js:101:20)
at REPLServer.emit (events.js:191:7)
at REPLServer.Interface._onLine (readline.js:241:10)
This is not a bug, but spec behaviour. Arrow functions can't have instances, and have no .prototype to check against. You'll have to pass a normal function to the library instead.
Ack, whether we like it or not, that鈥檚 what the spec says. I鈥檓 closing this as an answered question, but feel free to ask any follow-up questions that you may have.
Most helpful comment
This is not a bug, but spec behaviour. Arrow functions can't have instances, and have no
.prototypeto check against. You'll have to pass a normalfunctionto the library instead.