1// JavaScript - Given a range, how to check array contains all values?"
2// Use of .every() & .includes() combined.
3// Returns true or false.
4
5let range = [1,2,3,4,5,6,7,8,9] // Use this array to repeatedly checking against, does not change.
6let myArray = [8,6,7,5,3,1,2,4,9] // Array that fluctuates and checking for validity.
7
8let checker = (myArray, range) => (
9 range.every(value => (
10 myArray.includes(value))
11 );
12)
13
14console.log(checker(myArray, range)); // true.