Gert Hengeveld
Nov 6, 2015 · 1 min read

But [3, 3, 3, 3, 3] === [5, 5, 5] returns false, which is the point the author is trying to make. You could of course argue that [3] === [3] also returns false in JavaScript, which is because the two arrays aren’t identical (i.e. a reference to the same thing in memory) but instead are two different arrays which just happen to look alike. The solution is to use a deep equals function:

deepEqual([3, 3, 3, 3, 3], [5, 5, 5])

which also returns false.

Gert Hengeveld

Written by

Enabling Component-Driven Development with @ChromaUI and @Storybookjs.