Beats 87.63%🥳One Simple line with explanation😉✅
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\nUsing Sort method we can sort numbers that return from function ascending\n- if negative number means a is smaller than b so it will not changed\n- if positive number it means a is bigger than b so it will be order to right \n- in case of zero that means a & b are equal so no need to change\n```\n/**\n * @param {Array} arr\n * @param {Function} fn\n * @return {Array}\n */\nvar sortBy = function(arr, fn) {\n    return arr.sort((a, b) => fn(a) - fn(b));\n};\n```\n\n**Native Approch**\nhere we are comparing numbers and shifting the smallest one to left so at the end the array will be sorted\uD83D\uDE03\n```\n  for(let i=0;i<arr.length;i++){\n        for(let j=i+1;j<arr.length;j++){\n           if(fn(arr[i])>fn(arr[j])){\n               let temp = 0;\n               temp = arr[j];\n               arr[j] = arr[i];\n               arr[i] = temp\n           }\n        }\n    }\n    return arr;\n```
['JavaScript']