↗☻【数组】过滤筛选
jquery中的数组过滤筛选-$.grep()
http://www.css88.com/archives/2472
jQuery.grep()
http://api.jquery.com/jQuery.grep/
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8" /> <title></title> </head> <body> <script src="http://upcdn.b0.upaiyun.com/libs/jquery/jquery-1.5.2.min.js"></script> <script> var arr = [1, 9, 3, 8, 6, 1, 5, 9, 4, 7, 3, 8, 6, 9, 1]; console.log(arr); arr = $.grep(arr, function (n, i) { return (n != 5 && i > 4); }); console.log(arr); arr = $.grep(arr, function (a) { return a != 9; }); console.log(arr); arr = $.grep([0, 1, 2], function (n, i) { return n > 0; }, true); console.log(arr); </script> </body> </html>