码迷,mamicode.com
首页 > 编程语言 > 详细

移除数组中元素

时间:2018-05-03 16:44:20      阅读:150      评论:0      收藏:0      [点我收藏+]

标签:remove   filter   code   span   turn   结果   fun   bsp   move   

移除数组 arr 中的所有值与 item 相等的元素,直接在给定的 arr 数组上进行操作,并将结果返回

function removeWithoutCopy(arr, item) {
    return arr.filter(function(ele){
        return arr.splice(ele, item)
    })
}

 

移除数组中元素

标签:remove   filter   code   span   turn   结果   fun   bsp   move   

原文地址:https://www.cnblogs.com/lixiaoyao-1/p/8985689.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!