javascript check if element contains in arra code example
Example 1: see if array contains array javascript
const found = arr1.some(r=> arr2.indexOf(r) >= 0)
Example 2: how to check if an array contains a number in javascript
// To check if an array contains a number
const ratings = [1,2,3,4,5];
let result = ratings.includes(4);
console.log(result); // true
result = ratings.includes(6);
console.log(result); // false