var arr = [ 1, 9, 3, 8, 6, 1, 5, 9, 4, 7, 3, 8, 6, 9, 1 ];
$("div").text(arr.join(", "));
//1, 9, 3, 8, 6, 1, 5, 9, 4, 7, 3, 8, 6, 9, 1
arr = jQuery.grep(arr, function(n, i){
return (n != 5 && i > 4);
});
$("p").text(arr.join(", "));
//1, 9, 4, 7, 3, 8, 6, 9, 1
arr = jQuery.grep(arr, function (a) { return a != 9; });
$("span").text(arr.join(", "));
//1, 4, 7, 3, 8, 6, 1
数据过滤条件
最新推荐文章于 2022-02-04 14:51:49 发布