JS in the type:
Standard type: number, String, Boolean, Null, Undefined
Built-in object types: Function, Array, Date, RegExp, Math, JSON ...
Type identification:
1, typeof: Can identify the standard type (except Null, undefined), cannot judge the object, because all the specific object types are judged to be object,function except. such as typeof "123";//string
2, instanceof: Can identify the built-in object type, custom object type, does not recognize the standard type. such as: [] instanceof Array;//true
3, Object.prototype.toString.call: Can recognize the standard type, the built-in object type, does not recognize the custom object type. such as: Object.prototype.toString.call ("123"). Slice (8,-1);//string
4, constructor: All types can be recognized (except Null, undefined, because there is no constructor). such as: "123". constructor===string; True to find out who the Obj object is constructed from
JavaScript type and type judgment