Acronym string?

What am I doing wrong here?

If you pass [“Sue”, “Will”] it should return “SW”
If you pass [“Java”, Script", “Object”, “Notation”] it should return “JSON”

function acronym(arr){
    let str = '';
    for(let i = 0; i < arr.length; i++){
        str += arr[i][0];
    return str;
1 Like

What makes you think its “wrong”? What is it doing or not doing, and what is it you’re expecting?

I’m a jackass and have been testing:

acronym("Sue", "Will")

(Not as an array.) I need a break, lol

1 Like

Hahahaha!! I set up a fiddle, and did EXACTLY the same thing. And it returned the exact string, because it was doing exactly what I’d told it. Good catch.

1 Like