Life at the bleeding edge

😀Mind map notes 😀File Vault

😀老男孩 - python入门与提高实践

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

Here we see a graphic like below:

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

posted @ 2018-05-22 19:10  Clown--  阅读(114)  评论(0编辑  收藏  举报