I usually get it from the toString() return value. It works in differently accessed DOM elements:
var a = document.querySelector('a');
var img = document.createElement('img');
document.body.innerHTML += '<div id="newthing"></div>';
var div = document.getElementById('newthing');
Object.prototype.toString.call(a); // "[object HTMLAnchorElement]"
Object.prototype.toString.call(img); // "[object HTMLImageElement]"
Object.prototype.toString.call(div); // "[object HTMLDivElement]"
Then the relevant piece:
Object.prototype.toString.call(...).split(' ')[1].slice(0, -1);
It works in Chrome, FF, Opera, Edge, IE9+ (in older IE it return "[object Object]").