90
tahnik
8y

So I heard that you hate JavaScript...

Credit: Reddit

Comments
  • 10
    Stupid default sort... gets me every time.

    .sort((a, b) => a - b)
  • 5
    Leave me with Python & Ruby!
  • 1
    I usually use a binary tree instead just so I have the ability to say I used a binary tree in case the juniors haven't learnt it yet.
  • 0
    What is happening!?! 😱
  • 1
    @btfoom JavaScript's sort method by default sorts them as strings, which means it will do it alphabetically instead of numerically. You have to pass the sort method a sorting function in order to get the results you want. It's not a very efficient sort, might I add
  • 1
    @tytho thanks! I know that. Just meant to say that is my reaction when something like this happens.
  • 0
    And people still somehow use JS for the actual brain stuff
Add Comment