购物网站哪个最好,哪家公司建的沂南体育馆规划图,2021免费网站大全,凡客陈年现状添加 push#xff1a;数组末尾添加unshift#xff1a;数组首位添加splice(1, 0, ‘新增内容’)#xff1a;再指定位置插入#xff0c;第二参数为0#xff0c;表示新增#xff1b;大于0#xff0c;表示修改 删除 pop#xff1a;删除末尾shift#xff1a;删除首位slice(…添加 push数组末尾添加unshift数组首位添加splice(1, 0, ‘新增内容’)再指定位置插入第二参数为0表示新增大于0表示修改 删除 pop删除末尾shift删除首位slice(0, 1)删除指定数据不会改变原数组需要重新赋值splice(0, 1)删除指定位置的数据直接改变原数组 查询 indexOf索引查询lastIndexOf从数组末尾开始查找includes包含 翻转 reverse 排序 sort((a, b) a - b) 合并 concat 转换 join(‘,’) 数组转字符串 循环 For for(let i 0; i array.length; i) { } ForEach array.forEach((item, index) { item值index索引 }) Map - array.map((item, index) rerturn item); 返回新的[]every array.every((item, index, arr) item 1 ) 返回false/true Some: array.some((item, index, arr) item 1); 返回false/true Filter array.filter((item, index) item 1); 返回[ 1 ] Find array.find((item, index, arr) item 1); 返回1 / undefinedFindLastIndex[1, 2, 3, 5, 6].findLastIndex((item) item 1); 返回 4代表其中有4个数据大于1reduce array.reduce((acc, item) { return item acc }, 0 / []); 可累加可生成新的数组 for…of for(let value of array) {}