3 line solution
Code\n\nvar digitCount = function (num) {\n    let arr = Array(num.length).fill(0)\n    for (const ele of num) arr[ele]++\n    return arr.join(\'\') === num\n}\
# Code\n```\nvar digitCount = function (num) {\n    let arr = Array(num.length).fill(0)\n    for (const ele of num) arr[ele]++\n    return arr.join(\'\') === num\n}\n```
['JavaScript']