Deep Equal

作者
Engineering Manager, Robinhood
Languages

Implement a function deepEqual that performs a deep comparison between two values. It returns true if two input values are deemed equal, and returns false if not.

  • You can assume there are only JSON-serializable values (numbers, strings, boolean, null, objects, arrays).
  • There wouldn't be cyclic objects, i.e. objects with circular references.

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

公司

高级版功能购买高级版以查看出题公司。
查看计划