JSFiddle - React, Tailwind, and code Playground

JavaScript

var arr = [],
    text = "AAABBCCCCDEEE",
    current;

for(var i = 0; i < text.length; i++) {
    var char = text[i];
    
    if(char !== current) { // new letter
        arr.push(char);    // create new array element
        current = char;    // update current
    } else {                         // current letter continued
        arr[arr.length - 1] += char; // append letter to last element
    }
}

console.log(arr);