isContainedIn.md: rewrite descrpition

This commit is contained in:
Lucas Gabriel Schneider
2020-01-21 19:35:22 +00:00
committed by GitHub
parent 47b216c1eb
commit 1f3d3e9c04

View File

@ -6,7 +6,7 @@ tags: array,intermediate
Returns `true` if the elements of the first array are contained in the second one regardless of order, `false` otherwise.
Use a `for...of` loop over a `Set` created from the first array.
Use `Array.prototype.some()` to check if all distinct values are contained in the second array, use `Array.prototype.filter()` to compare the amount of occurences of each distinct value in both arrays.
Use `Array.prototype.some()` to check if all distinct values are contained in the second array, use `Array.prototype.filter()` to compare the number of occurrences of each distinct value in both arrays.
Return `false` if the count of any element is greater in the first array than the second one, `true` otherwise.
```js