1636. Sort Array by Increasing Frequency Javascript solution
\n\nvar frequencySort = function(nums) {\n    const map = new Map();\n    for (let n of nums) {\n        map.set(n, (map.get(n) + 1) || 1);\n    }\n    return n
```\n\nvar frequencySort = function(nums) {\n    const map = new Map();\n    for (let n of nums) {\n        map.set(n, (map.get(n) + 1) || 1);\n    }\n    return nums.sort((a, b) => map.get(a) - map.get(b) || b - a)\n};\n```
['JavaScript']