标签:func string style cti instance boolean ring nbsp back
js用来判断数据类型的方法有2种:typeof和instanceof,一般typeof就够用
1.typeof
typeof ‘123‘ //"string"
typeof一般只能返回如下几个结果:number,boolean,string,undefined,function,object
2.instanceof
new Date() instanceof Array //false new Date() instanceof Date //true
instanceof就是用于判断一个对象是否是哪个类
标签:func string style cti instance boolean ring nbsp back
原文地址:http://www.cnblogs.com/amiezhang/p/8006442.html