$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · easy · #51

What is the output?

console.log([1, 2, 3].indexOf(4));
  1. -1
  2. 0
  3. 3
  4. undefined
indexOf returns -1 when the value is not present.
Play Problem Solving ▸