0 points

JavaScript was made in 2 days through a drunken stupor, and it shows.

permalink
report
reply
0 points

This is due to the default sorter in JavaScript sorting by the string value. The reason for that is that this won’t create errors at runtime. Since JavaScript does not have types, this is the safest way of sorting.

This works:

const unsorted = [1, 100000, 21, 30, 4]
const sorted = unsorted.sort((a, b) => a - b) 
permalink
report
reply
0 points

Looks like they should have called that function sortOf()

permalink
report
reply

Programmer Humor

!programmer_humor@programming.dev

Create post

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics

Community stats

  • 6.4K

    Monthly active users

  • 712

    Posts

  • 9.9K

    Comments