JavaScript · Senior · Question 75 of 75
Is Array.prototype.sort stable in modern engines?
- ✓Correct answer: Yes, since ES2019 equal elements keep their original order
- 2No, the order of equal elements is random
- 3Only for arrays shorter than 10 elements
Explanation
Stability enables multi-key sorting: sort by name, then by department, and people within a department stay alphabetical.