Numbers in the wrong order
Take your time, follow the code and check your understanding.
The codeArrays
const values = [2, 10, 3];
values.sort(); // expected 2, 3, 10Your answer3 min · no timer
Show solution and explanation
Default sort compares string representations. A numeric comparator supplies numeric ordering.
Use sort((a, b) => a - b).