I would suspect that the way you’ve done it will, going foward, break in all browsers, so have a check on the current solution here:
https://github.com/freeCodeCamp/freeCodeCamp/blob/master/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/sort-an-array-alphabetically-using-the-sort-method.english.md
And have a search on the forums - this has come up a lot because of the hint code not working in Chrome (and the fact that the solution worked fine up until recently, so if you google around you’ll find a lot of people using this method to sort), here’s one of my earlier answers:
Solution passes for me, but technically it isn’t quite correct, so I think it will fail on some platforms. Someone in another thread was finding it failed on Chrome, it just didn’t sort at all. It works on Firefox and Chromium for me. I think Chrome changed how it implemented sort quite recently (in September afaik, from Chrome 70 onwards) so it might be due to that. Try clearing cache and resubmitting first though. Two things:
The function you give to sort should return -1 (or any negative nu…
1 Like