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

What is the output?

console.log([1, 2, 3, 4].slice(1, -1));
  1. [2, 3]
  2. [2, 3, 4]
  3. [1, 2, 3]
  4. [2]
A negative end counts from the tail, so the last item is excluded.
Play Problem Solving ▸