Untitled

mail@pastecode.io avatar
unknown
javascript
3 years ago
313 B
1
Indexable
Never
const reels = [
  [1, 6, 7, 6, 11],
  [5, 10, 15, 2, 3],
  [3, 11, 2, 11, 3],
  [11, 3, 4, 5, 7] 
];

const number = 11;

const esi = (reels, number) => 
  reels.flatMap(reel => reel
    .map((value, index) => value === number ? index : -1)
    .filter(value => value !== -1)
  )

console.log(esi(reels, number));