DEV Community

Discussion on: Frontend developer, Twilio hackathon winner, ecommerce developer turned React developer... Ask Me Anything!

Collapse
 
adrianbdesigns profile image
Adrian Bece

Hello, thanks for the question! :)

The worst bug was also the weirdest, incidentally.

So we had an array of objects that needed to be sorted by one of their attributes which is a numerical value. We had a bug report which stated that sorting (using JS array.sort) is not working on production (on Google Chrome) and, sure enough, it didn't work.

When we opened the page with the issue present on a local machine, everything worked as expected. There was no difference in the code and everything was up to date. It was a literal case of "it works on my dev machine".

Turns out, Node JS's sorting algorithm is not very consistent across environments. More info here: v8.dev/blog/array-sort

We have moved the sorting algorithm to lodash's sort method and everything worked correctly.