javascript get type of element code example
Example 1: how to know type of dom element in js
let divElement = document.createElement('div');
if (divElement.nodeName == "DIV")
if (divElement.nodeName == "<div>")
Example 2: js get element type
var element_type = field.tagName;
Example 3: js typeof number
console.log(typeof 93);
console.log(typeof 'Maximum');
console.log(typeof false);
console.log(typeof anUndeclaredVariable);
Example 4: javascript check type of variable var
typeof "hello"
var a = 1;
typeof(a);