Skip to content

Latest commit

 

History

History
17 lines (13 loc) · 446 Bytes

includesAll.md

File metadata and controls

17 lines (13 loc) · 446 Bytes
title tags
includesAll
array,beginner

Returns true if all the elements in values are included in arr, false otherwise.

  • Use Array.prototype.every() and Array.prototype.includes() to check if all elements of values are included in arr.
const includesAll = (arr, values) => values.every(v => arr.includes(v));
includesAll([1, 2, 3, 4], [1, 4]); // true
includesAll([1, 2, 3, 4], [1, 5]); // false