Sriker Ch Sriker Ch - 8 months ago 24
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.