문제 링크 : Check if Number Has Equal Digit Count and Digit Value
/**
* @param {string} num
* @return {boolean}
*/
var digitCount = function(num) {
const arr = new Array(10).fill(0)
num.split('').forEach(e => {
arr[e] += 1
})
for(let idx in num) {
if( +arr[idx] !== +num[idx] ) return false
}
return true
};