const sortedCompanies = companies.sort(function(c1, c2) { if(c1.start > c2.start) { return 1; } else { return -1; } }); const sortedCompanies = companies.sort((a, b) => (a.start > b.start ? 1 : -1)); // Sort ages const sortAges = ages.sort((a, b) => a - b);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter