I was playing around with instanceof
in Chrome but I got an error message. I think I know why (you have to supply a function after the instanceof
keyword that is the constructor the object was created with), but the error message seems to be stating something else:
[1,2,3] instanceof Array
// true
[1,2,3] instanceof []
// TypeError: Expecting a function in instanceof check, but got 1,2,3
Does this mean that I should replace [1,2,3]
with a function? I would think that [1,2,3]
is correct and that []
is the problem and should be replaced with a function, but it looks like the error message is saying the opposite.
Could someone please explain how I'm interpreting the error message incorrectly?