Skip to content

Instantly share code, notes, and snippets.

@supertrens
Created September 4, 2017 17:06
Show Gist options
  • Save supertrens/9743853f669e25df29bf76054c241f11 to your computer and use it in GitHub Desktop.
Save supertrens/9743853f669e25df29bf76054c241f11 to your computer and use it in GitHub Desktop.
/*===================================== OVERVIEW ================================
* This Function will recieve to arrays as parameters
* and return a boolean.
*
* ==================================== PARAMS ==================================
* arraySet --> 1st parameter that contains an array of elemnts
* arraySubset --> 2nd parameter that contains the array that we are going
* to check if it is inside of the array from param1 or not.
*
*
*===================================== RETURN====================================
* The method will return 'true' if the second arraySubset(Param2)
* is a subset of arraySet(param1) and return 'false' otherwise
*/
function isSubset(arraySet , arraySubset){
for(let element of arraySubset){
//check if each different element is included in the arraySet or not
if(arraySet.includes(element))
continue; //check the next one
else
return false;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment