const chars = ["a", "b", "c", "a", "a", "c"]; let result = {}; result = chars.reduce((acc, item) => { acc[item] = acc[item] ? ++acc[item] : 1; return acc; }, result);
{ a: 3, b: 1, c: 2 }