I want to know if the variable myVar
is a node.
I could check myVar.nodeType
, but then I could be fooled by {nodeType:1}
Then, I wonder if I can do something like
myVar instanceof Node
Edit
Funny, it seems that there is a Node
constructor, so instanceof Node
works, indeed!
I should have tried if my guess worked before asking...
Please don't mark my question as a duplicate of Check if variable is a valid node element, because this other question assumes that myVar
is a node or is empty. But my question doesn't assume anything.