If I have two variables
var foo = document.getElementById('myDiv');
var foo2 = document.getElementsByClassName('divCollection');
How can I check if a variable is an element, and how can I check if it is an HTMLcollection
?
I tried using typeof myVar
, but both variables return an object
.