JS是web开发经常使用到脚本语言,网上有很多,对于JS的一些数据类型,有个简单了解很有必要;
JS中有5种基本数据类型:Undefined、Null、Boolean、Number和String。
String类型:string,
Number类型:number,
Boolean类型:boolean,
Undefined类型:undefined,
Null类型:null,
JS数据类型判断:
String: typeof object === "string"
Number: typeof object === "number"
Boolean: typeof object === "boolean"
Object: typeof object === "object"
null: object === null
//jQuery扩展判断一些对象,如函数,数组等
·Plain Object: jQuery.isPlainObject( object )
·Function: jQuery.isFunction( object )
·Array: jQuery.isArray( object )
·Element: object.nodeType
·null or undefined: object == null
·undefined:
·Global Variables: typeof variable === "undefined"
·Local Variables: variable === undefined
·Properties: object.prop === undefined