Possible Duplicate:
Using jQuery to compare two arrays
I need a Javascript or jQuery function to determine if an array contains all the values of another array. The second array can have more values than the first.
This should return either true or false. For example.
comparing array1 = [1,2,3] and array2 = [1,2] should return false
comparing array1 = [1,2,3] and array2 = [1,1,2] should return false
comparing array1 = [1,2,3] and array2 = [3,2,1] should return true
comparing array1 = [1,2,3] and array2 = [1,2,1,3] should return true
Performance is not a concern. Thanks!
Checks each element in the first array and sees if it exists in the second array.
NB. This is pure javascript, might be an easier way in jQuery.