判断是否是数组

  var a =[1,2,3];

  //方法一:
  //alert(toString.call(a));   // "[object Array]"

  //方法二:
  //alert(a instanceof Array)   //true

  //方法三:
  alert(a.constructor == Array) //true

 

posted on 2018-06-07 09:44  婆婆买了只kitty  阅读(89)  评论(0编辑  收藏  举报

导航