// compare two arrays where order might differ
const array1 = [1,2,3,4,5];
const array2 = [3,4,1,2,5];
const compareArrays = (array1, array2) => {
return (
array1.length === array2.length &&
array1.every((el) => array2.includes(el));
);
};
compareArrays(array1, array2); // true