摘要: reduce()方法 定义:reduce()接收一个函数作为累加器,数组中每个值(从左到右)开始缩减,最终计算为一个值 对于空数组不执行回调函数 语法:array.reduce(function(total, currentValue, currentIndex, arr), initialValu 阅读全文
posted @ 2018-03-07 16:04 麦芽无心 阅读(4193) 评论(0) 推荐(0) 编辑
摘要: 数组中常用的方法 1)splice() 向数组中添加/删除项目,然后返回被删除的项目 会改变原始数组 用法:array.splice(index, howmany, item1, item2, ...itemx); index: 必需。整数添加或删除的位置,使用负数从数组结尾处规定位置 howman 阅读全文
posted @ 2018-03-07 13:52 麦芽无心 阅读(238) 评论(0) 推荐(0) 编辑