a = [-1, 150, 190, 170, -1, -1, 160, 180]
Given the above, how can I get another array of the indexes where -1
is found?
I was able to do it with a for loop and checking against the desired number, then getting the number of the iteration and pushing into an array. Wondering if there's a one liner or a way that won't involve a for loop.