Perform Deep Structural Equality Comparison Between Two Arrays or Objects
Implement a deepEqual(a, b) function that returns true if two values are structurally identical — recursively comparing nested objects, arrays, primitive values, and special types like Date, RegExp, null, and undefined. It should NOT rely on JSON.stringify (which fails for undefined, functions, and ordering issues). This is the core of React's shallow vs deep equality, Jest's toEqual matcher, and immutability checks in state management.