Example For jQuery.grep

Sabarimahesh
Posted by Sabarimahesh under jQuery category on | Points: 40 | Views : 2090
var arr = [ 1,8, 6, 2, 3];
$("div").text(arr.join(", "));

arr = jQuery.grep(arr, function(n, i){
return (n != 3&& i > 4);
});
$("p").text(arr.join(", "));

arr = jQuery.grep(arr, function (a) { return a != 1; });
$("span").text(arr.join(", "));

Comments or Responses

Login to post response