2015
12-21
12-21
JavaScript 判断该对象是否为数组
1.typeof首先我们会想到的是使用typeof来检测数据类型,但是对于Function,String,Number,Undefined等这几种基本类型来说,使用typeof来检测都可以检测到,比如代码如下:functiontest(){}console.log(typeof1);//numberconsole.log(typeoftest);//functionconsole.log(typeof"yunxi");//stringconsole.log(typeofundefined);//undefined但是对于数组或者正则来说,使用typeof来检测的话,那就满足不了,因为...
继续阅读 >