In my code, I am populating an array with sub-arrays of the same type (numbers) and the same size (2). These sub-arrays, when compared using strict equality operator, always return false:
[2, 0] === [2, 0]
I have come up with two ways to compare these sub-arrays:
- Using a loop to test if each member at corresponding indexes are equal.
- Converting each sub-array to string and then comparing them.
However, I feel like there might be a better approach to solve this issue. What do you suggest?