check fpr multiple values in an array jquery

Solutions on MaxInterview for check fpr multiple values in an array jquery by the best coders in the world

showing results for - "check fpr multiple values in an array jquery"
Stefania
27 Mar 2020
1function containsAll(needles, haystack){ 
2  for(var i = 0; i < needles.length; i++){
3     if($.inArray(needles[i], haystack) == -1) return false;
4  }
5  return true;
6}
7
8containsAll([34, 78, 89], [78, 67, 34, 99, 56, 89]); // true
9containsAll([34, 78, 89], [78, 67, 99, 56, 89]); // false
10containsAll([34, 78, 89], [78, 89]); // false
11