let arr = [1,2,3]
let arr2 = [3,1,2]
let arr3 = [1,2,2]
let arr4 = ['1',2,3]
let compare = (arr,arr2) => JSON.stringify(arr.sort()) === JSON.stringify(arr2.sort())?true :false
console.log(compare(arr,arr2));
console.log(compare(arr2,arr3));
console.log(compare(arr,arr4));