Checks if the target matches the specified tagName. If the target doesn't exist or is invalid, returns false.
target
tagName
false
Tag name of element representation of specified target.
Element, EventTarget, or CSS selector.
Tag name to check for (e.g. div, span, etc.).
div
span
true if the target is of type tagName.
true
You can't UPPERCASE the tagName without getting a type error. That's because this function converts it to lowercase before checking.
UPPERCASE
Checks if the
target
matches the specifiedtagName
. If thetarget
doesn't exist or is invalid, returnsfalse
.