2724-sort-by

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