![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
原生js练习
澜痕
这个作者很懒,什么都没留下…
展开
-
数组的数据扁平化
要求: 给定一个arr = [[1, 2], [3, 4, 5], [6, 7, 8, 9, [11, 12, [13, [14]]]], 10]; 输出: [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 10] 实现思路: 新建一个空数组,遍历需要扁平化的数组,循环在空数组中放入每一个数据,如果该数据还是一个数组,则再次调用函数本身,通过…解开该函数的返回值,然后放入空数组内 Array.prototype.flatten = function () {原创 2021-05-31 10:53:56 · 140 阅读 · 0 评论 -
关于数组方法filter,map,every的练习
现在有这么一个表,要求返回所有科目及格的学生姓名及相关科目信息 students = [ { name: 'lili', course: '语文', score: 67, }, { name: 'lili', course: '英语', score: 62, }, {原创 2021-05-21 22:55:05 · 129 阅读 · 0 评论