JavaScript | Map
js\n/**\n * @param {string} num\n * @return {boolean}\n */\nvar digitCount = function(num) {\n    const numLength = num.length;\n    const numArray = num.split(
```js\n/**\n * @param {string} num\n * @return {boolean}\n */\nvar digitCount = function(num) {\n    const numLength = num.length;\n    const numArray = num.split(\'\').map(Number);\n    let result = "";\n    \n    const numFreq = numArray.reduce((acc,item)=>acc.set(item,acc.get(item) + 1 || 1),new Map())\n    \n    for(let i=0;i<numLength;i++){\n        result+=numFreq.get(i) || "0";        \n    }\n    \n    return result === num\n};\n```
[]