Checking Object Type and Validating the Argument Type in JavaScript

advertisement

advertisement

The “typeof” operator is very useful at the moment for checking what kind or type of object we are dealing with. It returns a string containing the datatype of the object.