我不断收到“类型错误:str.join不是函数。该代码应该采取一个字符串输入,并使每个在输入的下一个字母字母(即A-> b,Z-> a)和大写每个元音。有谁知道为什么它仍然是错的?仍然不工作 - 函数:字母到下一个字母(即a-> b)和大写元音
str = str.split("");//split() string into array
for(var i=0;i<str.length;str++){//for loop that checks each letter
if(str[i].match(/[a-y]/i)){
str[i]=String.fromCharCode(str[i].charCodeAt(0)+1);
}else if(str[i].match('z')){
str[i] = 'a';
}
if(str[i].match(/[aeiou]/i)){
str[i] = str[i].toUpperCase();
}
}
str2= str.join('');
//modifies letter by adding up in alphabet
//capitalizes each vowel
//join() string
return str2;
}
// keep this function call here
// to see how to enter arguments in JavaScript scroll down