You are viewing a single thread.
View all comments
7 points

I couldn’t believe it, tried it out, what the actual heck? I mean I get all these weird string vs number comparison but sorting actual numbers and this comes out? What kind of drugs were the designers of javascript (or at least this function) on… Who thought it was a good idea to sort numbers lexicographically??

permalink
report
reply
1 point

Iirc Array.sort requires you to pass a function in, or it casts into strings and sort them.

permalink
report
parent
reply
5 points

Probably meth or cocaine, considering js was written by a single person in 10 days

permalink
report
parent
reply
1 point
*
Deleted by creator
permalink
report
parent
reply
1 point

That way they get to reuse the code for sorting strings!

permalink
report
parent
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

  • 3.2K

    Monthly active users

  • 1K

    Posts

  • 37K

    Comments