我的代码有什么问题吗?它似乎只获取了第一个字母,而while循环没有进入下一个单词。那我可能遗漏了什么?
function acr(s){
var words, acronym, nextWord;
words = s.split();
acronym= "";
index = 0
while (index<words.length) {
nextWord = words[index];
acronym = acronym + nextWord.charAt(0);
index = index + 1 ;
}
return acronym
}