check element type 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 type javascript
console.log(typeof "how are you?")
"string"
console.log(typeof false) / console.log(typeof true)
"boolean"
console.log(typeof 100)
"number"