how to know type of dom element in js

JavaScript
let divElement = document.createElement('div');

if (divElement.nodeName == "DIV") //true
if (divElement.nodeName == "<div>") //false
Source

Also in JavaScript: