![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数组
文章平均质量分 69
MR·Feng
这个作者很懒,什么都没留下…
展开
-
javascript 数组
var arr = [ 1, 2, 3, 4, 5, 0, 4, 32, 1, 7, 78, 34, 234, 67, 5, 4, 1, 0 ];var arr1 = [ null, 'a', 999, undefined ];var obj = { name: 'zhangsan', age: 99 };1、 ES6去重Array.from(new Set(arr)).filter(x => x); // [1, 5, 3, 2, 4, 9]Array.from(new Set(ar.原创 2020-12-24 12:51:57 · 161 阅读 · 4 评论 -
常用封装函数
1、数组去重并过滤数组中的所有假值1) unique: o => Array.from(new Set(o)).filter(x=>x)2) unique: o => [...new Set(o)].filter(x=>x)2、判断返回值是否为数组\对象1) isArray: o => Object.prototype.toString.call(o...原创 2019-11-21 14:46:50 · 1078 阅读 · 2 评论 -
es6数组操作
ES6 新特性之数组扩展Array.from()from 方法用于将两类对象转为真正的数组:类似数组的对象(array-like object)和可遍历(iterable)的对象(包括ES6新增的数据结构Set和Map)。语法Array.from(arrayLike[, mapFn[, thisArg]])参数arrayLike 想要转换成数组的伪数组对象或可迭代对象...转载 2018-07-23 12:01:06 · 715 阅读 · 0 评论 -
ES6,ES5 判断数组维数
<!DOCTYPE html><html> <head> <title> ES6,ES5 判断数组维数 </title> </head> <body> <script type="text/javascript"&原创 2018-11-20 17:28:44 · 965 阅读 · 2 评论