数组常用方法汇总

87 阅读1分钟

常用数组方法

数组方法是否返回新数组用法
map()新数组中的元素为原始数组元素调用函数处理后的值。
filter()新数组中的元素是通过检查指定数组中符合条件的所有元素

判断是对象还是数组

法1):

Array.isArray(arr)  //true
Array.isArray(obj)  //false