Typescript | Clean and simple solution
\nfunction frequencySort(nums: number[]): number[] {\n    \n    const freq: Record<number, number> = {};\n    \n    nums.forEach(num => freq[num] = (freq[num] |
```\nfunction frequencySort(nums: number[]): number[] {\n    \n    const freq: Record<number, number> = {};\n    \n    nums.forEach(num => freq[num] = (freq[num] || 0) + 1);\n\n    return nums.sort((a, b) => freq[a] != freq[b] ? freq[a] - freq[b] : b - a);\n};\n```
['TypeScript', 'JavaScript']