Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 15851

How to find the position(s) of a number in a 2D array?

$
0
0

For example, how could I find the positions that contain the value 20 in the following 2D array?

let nested_array = [    [17, 16, 15, 14, 13],    [18, 5, 4, 3, 12],    [19, 6, 1, 2, 11],    [20, 7, 8, 9, 10],    [21, 20, 23, 24, 25],];

Values might not be unique.


Viewing all articles
Browse latest Browse all 15851

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>