const array =
[
[1,2,3],
[4,1,1,3]
[5,5,7]
]
const newArray = [2,3,1]
How I can find with javascript if this array exists in the array (exists with other order)
I sloved this by sort the array and check with JSON.stringify
let conflictIds = [...conflictsList.map(c=>c._id), ssdst._id]
conflictIds = conflictIds.sort();
if(!existsInArray(conflictsArr, conflictIds)){
const conflictObj = {schedules:conflictIds .... }
conflictsArr.push(conflictObj)
}
const existsInArray = (array, newElement)=>{
return array.find(arr=>JSON.stringify(arr.schedules) ===JSON.stringify(newElement) )
}