JS -проверка, есть ли два массива такого же элемента
const intersection = array1.filter(element => array2.includes(element));
Lonely Loris
const intersection = array1.filter(element => array2.includes(element));
// if not nested arrays
function checkEquals(arr1, arr2) {
return arr1.every( el => arr2.includes(el) );
};