统计字符串中字符出现的次数

        var a = {};
        var str = 'gouod'.split("");
        str.forEach(function (v, i) {
            a[v] = a[v] == undefined ? 1 : a[v] + 1;
        })
        console.info(a)
原文地址:https://www.cnblogs.com/gouyanfeng/p/4107641.html