[Discourse] Paraphrase "Type" in JS in one time

Here we see a graphic like below:

[Discourse] Paraphrase "Type" in JS in one time

Now we use "typeof" and "instanceof" these built-in methods to inspect them.

instanceof

You can't do any of instanceof operation on the top row, it's special to the left coloum.
The instanceof operation to left coloum will either equal to their specific type OR "Object" type.

typeof

typeof to any item will return it's corresponding type in the top row except null, it will return object. It's a buggy for 2 decades.
typeof to any item will return it's object type in the left coloum except Function. it's will return function.

Need to be mentioned

Basic type : object, string, number, boolean, null, undefined. Not include function.
Object type: Object, String, Number, Boolean, Function, Array, Date, RegExp, Error

转载于:https://www.cnblogs.com/steadfast-JSer/articles/9073597.html