判断数据类型的几种方法

1、统用的方法:

   判断是否为函数;是否为数组;字符串;数值;布尔;undefind

    Object.prototype.toString.call(show);

2、arguments不是数组只是个对象,它只有 length属性 和通过索引取出值,没有数组的任何方法;

   如果想让arguments有数组的方法,则:

  Array.prototype.splice.call(arguments); 

   或者:Array.prototype.slice.call(arguments); 

猜你喜欢

转载自www.cnblogs.com/zhaodagang8/p/11083745.html
今日推荐