javascript
intermediate
Risolta
Termina il 2026-11-17
Deep equality
Write deepEqual(a, b) that compares two values by content, the way test libraries do.
- Primitives compare with
===, except thatNaNequalsNaN. - Arrays are equal when they have the same length and equal items in order.
- Plain objects are equal when they have the same keys and equal values (key order does not matter).
- Dates are equal when they hold the same time.
Acceptance criteria
deepEqual([1, 2], { 0: 1, 1: 2 })isfalse(an array is not an object).- The tests at the bottom print
All tests passed.
Risolta finora da 0 persone.
EditorCtrl + Enter
Quando i test mostrano "All tests passed", la sfida viene segnata come risolta in questo browser.
Invia la tua soluzione per la revisione