I have an array of arrays:
[ [0,0], [0,0], [3,2], [5,6], [15,9], [0,0], [7,23], ]
I could use something like .indexOf(0) if I wanted to find the first index of the zero value, but how to find the index of the first non-zero value, or which meets some criteria?
It may look like .indexOf(function(val){ return val[0] > 0 || val[1] > 0;}) , but this one is not supported.
How can I solve this problem in the most elegant way?
source share