var arr='aaabbccaa'; var info = arr.split('').reduce((p, k) => (p[k]++ || (p[k] = 1), p), {}); console.log(info);
得到:Object {a: 5, b: 2, c: 2}