Jquery 实现从数组中删除指定的值

Posted ·437 Views·105 Words

var arr = [1, 2, 3, 4, 5]; //原数组
var removeItem = 2; //要删除的值
arr = $.grep(arr, function(value) {
    return value != removeItem;
});

Comment

Leave a comment to join the discussion