Check if an Array Is Within a 2D Array Using JavaScript

Solving pass-by-reference with an algorithm

Matt Cummings
Better Programming
Published in
5 min readMar 9, 2020

--

Photo by Laura Ockel on Unsplash.

At some point, you’ve probably run across the issue of comparing arrays with one another. Due to pass-by-reference, we can’t simply check if [1,2,3] is the same as [1,2,3].

This was an issue for me when I was trying to solve a Leetcode problem where the goal was to get all…

--

--