Understanding Type Checking in JavaScript Using typeof
In JavaScript, the type checking operator typeof returns the data type of the argument that was supplied to it. Any variable, function, or object whose type you want to determine using the typeof operator can be used as the operand. The typeof operator can be used to check the data type before execution because JavaScript is a dynamically typed language, which means that you do not need to define the type of variables when declaring them.