If I had an array of letters how would I go about turning each letter into an object key with a value of how many there are in that array in JavaScript?
For example:
const array = ['a', 'b', 'c', 'c', 'd', 'a'];
const obj = { a: 2, b: 1, c: 2, d: 1};