Open Mardanjan opened 4 years ago
var str = '大家好啊我是张家辉啊是哪个系兄弟来看我的张家辉啊啊啊啊' var arr = str.split('') qwe(arr) var result = arr.reduce(function(acc, cur) { if (cur in acc) { acc[cur] ++ } else { acc[cur] = 1 } return acc }, {}) qwe(result)