Sriker Ch Sriker Ch - 4 months ago 12x
Javascript Question

Sort returning different results in different browsers

function sort(type) {
$.getJSON("raw_data.json", ({ Search }) => {
Search.sort((a, b) => a[type] > b[type]);
console.log(`Sorted by: ${type}`);

Different results are shown in different browsers, but the correct one is showing in firefox devoloper edition and wrong results are shown in chrome browser.


Are you trying it in file:f// or http:// if not http:// try it.and chrome browser does not allow cross domain requests so instead of get you can use getJSON(url,function(){---code---});)
as you mentioned that retrieving data from Omdb api.