I have the following code:
function accum(s) {
let resultado = "";
let cadenaAgregar = "";
s.split("").forEach((item, i) => {
cadenaAgregar += item.repeat(i + 1);
cadenaAgregar[0].toUpperCase();
resultado += cadenaAgregar;
cadenaAgregar = "";
});
return resultado;
}
console.log(accum("abcd"));
Before the string is added to the 'result' variable the first letter is supposed to be converted to uppercase but this doesn't work, I'd appreciate knowing why this is happening and what I should do