0

It must be something easy; however I cannot find it...

function isDOM(obj)
{   
    if (obj.nodeType!==undefined)
        console.log(obj,' is DOM element');
    else
      console.log(obj,' is not DOM element');
}

The above function checks if object obj is a member or not of DOM. However, I want a reply like that:

document.body is DOM element

by calling isDOM(document.body); How may I catch the string 'document.body' as to pass it inside console.log and get exactly the argument name to the console?

Thank you

Unknown developer
  • 5,414
  • 13
  • 52
  • 100

0 Answers0