const arrayDeepEqual = (a, b) => a.length === b.length && a.every((x, i) => deepEqual(x, b[i]))
const deepEqual = (a, b) =>
Array.isArray(a) && Array.isArray(b)
? arrayDeepEqual(a, b)
: typeof a == 'object' && a && typeof b == 'object' && b
? arrayDeepEqual(Object.entries(a), Object.entries(b))
: Number.isNaN(a) && Number.isNaN(b) || a === b
const b = deepEqual(x, y)