Home > Article > Web Front-end > Javascript determines the specific class reprint of object_javascript skills
Everyone knows that Javascript's typeof can get the type of a variable, but typeof has only six return values: "number," "string," "boolean," "object," "function," and "undefined."
In fact, Javascript also has many special categories such as Array and Date. Why can't they be returned in typeof?
It turns out that Javascript classifies Array, Date Object, etc. into the object class. We can only use instanceof to do it. Determine the accurate category of object.
Here is a simple example to illustrate the usage of instanceof