One line
\n# Code\ntypescript []\ntype JSONValue = null | boolean | number | string | JSONValue[] | { [key: string]: JSONValue };\ntype Fn = (value: JSONValue) => number
\n# Code\n```typescript []\ntype JSONValue = null | boolean | number | string | JSONValue[] | { [key: string]: JSONValue };\ntype Fn = (value: JSONValue) => number\n\nfunction sortBy(arr: JSONValue[], fn: Fn): JSONValue[] {\n    return arr.sort((a,b) => fn(a) - fn(b))\n};\n```
['TypeScript']