Javascript Array isSubsetOf(originalArray)

Description

Javascript Array isSubsetOf(originalArray)


Array.prototype.isSubsetOf = function(originalArray) {
  var isSubset = true;
  for(var i=0;i<this.length;i++) {
    if(!(originalArray.includes(this[i]))) {
      isSubset = false;/*from  w  ww . jav a 2s .co m*/
    }
  }
  return isSubset;
};



PreviousNext

Related