JavaScript Easy Solution | One-linear | Beats 100% Faster :)
Code \njavascript []\nconst sortBy = (arr, fn) => arr.sort((a, b) => fn(a) - fn(b));\n
# Code \n```javascript []\nconst sortBy = (arr, fn) => arr.sort((a, b) => fn(a) - fn(b));\n```
['JavaScript']