Skip to content

2724-sort-by

DevGod
DevGod
Vtuber
/**
* @param {Array} arr
* @param {Function} fn
* @return {Array}
*/
var sortBy = function(arr, fn) {
return arr.sort((a, b) => fn(a) - fn(b));
};