algorithms-exercises
algorithms-exercises copied to clipboard
Created with CodeSandbox
Makes Bubblesort Jest test pass
fix syntax
by default if not passed a comparator function the sort function will sort items as string https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort. So giving the number comparator function here so it sorts correctly.
According to MDN docs on [Array.prototype.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) >The default sort order is ascending, built upon converting the elements into strings ```javascript [100,2].sort() // [100, 2] ``` So we would need the...
**unit tests bug** unit tests rely on `Array.sort` . However, there is no comparison function which will sort the array as they were strings. Not sure why tests passed in...
I saw multiple pull requests to fix this so I'm opening an issue to see it solution will get merged. #23 #13 #9
Updating testing from test -> describe. It threw an error switching to match the solution which uses describe.