Implement a function deepEqual(a, b) that checks whether two values are deeply equal.
The function should:
true if a and b are equal in value and structure.false otherwise.Examples
deepEqual('foo', 'foo'); // true deepEqual({ id: 1 }, { id: 1 }); // true deepEqual([1, 2, 3], [1, 2, 3]); // true deepEqual([{ id: '1' }], [{ id: '2' }]); // false deepEqual({ a: [1, { b: 2 }] }, { a: [1, { b: 2 }] }); // true deepEqual({ a: [1, { b: 2 }] }, { a: [1, { b: 3 }] }); // false
JavaScript Function
No test results yet
Click "Run" to execute tests