Frequency of characters in a string javascript

Viewed 31

The question requires me to return an object containing the amount of times each letter appeared in the string

my code

function frequencyAnalysis(t){
    let frequency=[];
    t.split('');
    

    return frequency;
}

i want to know how i can find the frequency of the letters from the inputted string Can someone walk me through on what to do. I want to write the code myself.

Example given

frequencyAnalysis('abca'); // => {a: 2, b: 1, c: 1}
0 Answers
Related