Array FindIndex Method

Get the index of the first element matching a condition.

Preview

Code

<script>
let numbers = [4,7,12,20];

let index = numbers.findIndex(function(n){
  return n > 10;
});

console.log(index);
</script>

More JS Iterations Examples (7)