$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · medium · #101

What is the output?

console.log([10, 9, 8].findIndex((x) => x < 9));
  1. 2
  2. 8
  3. -1
  4. 1
findIndex returns the position of the first match, not the value.
Play Problem Solving ▸