If I have a scenario with a 2d array structured as follows:
[
[0,1,4,2,2,5,5,0],
[1,1,4,4,2,2,5,3],
[1,6,6,6,7,7,3,3]
]
And if I want to create a new 2d array by abstracting the identical numbers like shown below: {any one of these}
[
[0,1],
[1,1],
[1,0]
]
[
[2,2,0],
[0,2,2]
]
[
[0,3],
[3,3]
]
[
[4,0],
[4,4]
]
[
[5,5],
[0,5]
]
[
[6,6,6]
]
How can I achieve this kind of logic in JavaScript? Essentially, I need a solution to generate one multidimensional array based on the duplication of numbers in the original 2d array.