SOURCE

var arr = 'abcdaabca';

var info = arr
    .split('')
    .reduce((p, k) => (p[k]++ || (p[k] = 1), p), {});

console.log(info); //{ a: 3, b: 2, c: 2, d: 1 }
console 命令行工具 X clear

                    
>
console