Implement a function deepEqual that performs a deep comparison between two values. It returns true if the two input values are deemed equal and false otherwise.
You can assume there are only JSON-serializable values (numbers, strings, booleans, null, objects, arrays).
There will not 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
Asked at these companies
Unlock company signalsPremium shows which companies ask this question so you can prioritize practice by target company.