javascript given range how to make sure array contains all values?
// JavaScript - Given a range, how to check array contains all values?"
// Use of .every() & .includes() combined.
// Returns true or false.
let range = [1,2,3,4,5,6,7,8,9] // Use this array to repeatedly checking against, does not change.
let myArray = [8,6,7,5,3,1,2,4,9] // Array that fluctuates and checking for validity.
let checker = (myArray, range) => (
range.every(value => (
myArray.includes(value))
);
)
console.log(checker(myArray, range)); // true.
Also in JavaScript:
- javascript array vs object
- js api call
- javascript filter array of objects by id
- syntax for srcset in react
- good javascript ide
- remove last 3 characters from string javascript
- node js ffmpeg image to video
- javascript show stack trace
- inline z-index react
- manifest.json basic structure
- how to call a script from another script in javascript
- jquery continue in loop each
- console trace js
- javascript define a global variable
- javascript while
- jQuery change select value
- how to hide javascript element by class
- initialize state react
- error metro bundler process exited with code 1 react native
- jquery create element properties
- react hook form rating material ui
- javascript format rupiah
- fetch
- how to add array numbers in javascript