Acronym string?

Acronym string?
0

#1

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;
};

#2

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


#3

I’m a jackass and have been testing:

acronym("Sue", "Will")

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


#4

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.