Why does this JavaScript sort put 10 before 2?

Why does this JavaScript sort put 10 before 2 in a leaderboard. The JavaScript code uses sort without a comparator, so numbers are sorted as strings. In JavaScript apps this breaks every numeric ranking.

#whatswrongwiththisjavascriptcode #javascriptbug #javascriptproductionbug #javascriptdebugging #javascriptbackend #javascriptcodereview #javascriptsecurity #javascriptperformance #javascriptreliabili...

https://www.youtube.com/watch?v=L7zOu_uaOD4

Why does this JavaScript sort put 10 before 2? #javascriptengineering

YouTube