JavaScript Determines if an array is contained within another array.

jQuery
function ArrayContainsArray(arr1, arr2) {
  var doesContain = true;
	
  $.each(arr1, function (){
    var arr1Item = this;       
    var object = $.grep(arr2, function(o){
      return arr1Item == o;
    });

    if (object.length === 0) { doesContain = false; }
  });

return doesContain;
}
Posted by
Snippet Viewed 1286 times.

Share your JavaScript code snippets:

  • Get some recognition & link back to your site.

 

Submit | Browse

Most Recent javascript snippets

Most Viewed