Sort Returning Different Results In Different Browsers
function sort(type) { $('#parentDiv').empty(); $.getJSON('raw_data.json', ({ Search }) => { Search.sort((a, b) => a[type] > b[type]); console.lo
Solution 1:
The sort function should return a number,
a number less than 0 will move element A to a lower index than B
a number greater than 0 will move element B to a lower index than A
if the number is zero it will leave the elements at the same place.
More about the sort function here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
Post a Comment for "Sort Returning Different Results In Different Browsers"