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

What is the output?

console.log([10, 1, 5].sort());
  1. [1, 10, 5]
  2. [1, 5, 10]
  3. [10, 5, 1]
  4. [5, 1, 10]
Default sort compares strings, so '10' precedes '5'.
Play Problem Solving ▸