我不斷收到「類型錯誤: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