how to check type of element in javascript code example
Example 1: how to know type of dom element in js
let divElement = document.createElement('div');
if (divElement.nodeName == "DIV") //true
if (divElement.nodeName == "<div>") //false
Example 2: check data type in js
var x = "Hello World";
typeof x; // "string"