-2

That is such with tag name and attributes so then I can safely use for example hasAttribute, tagName and other similar methods.

(My question is for a method of positively asking for html element, not for example ruling out all possibilities like string, number, some kind of other object etc.)

rsk82
  • 28,217
  • 50
  • 150
  • 240

1 Answers1

0

You check if it is an instance of HTMLElement

if (varName instanceof HTMLElement){
   // do what you want with the node
}
Gabriele Petrioli
  • 191,379
  • 34
  • 261
  • 317