我试图使所有常量都在它们旁边,但是没有任何作用。这是这里的javascript代码。
function opishConversion(text) {
var output = "";
for (var i = 0; i < text.length; i = i + 1) {
if ((text.charAt[i] !== "a") || (text.charAt[i] !== "A") || (text.charAt[i] !== "e") || (text.charAt[i] !== "E") || (text.charAt[i] !== "i") || (text.charAt[i] !== "I") || (text.charAt[i] !== "o") || (text.charAt[i] !== "O") || (text.charAt[i] !== "u") || (text.charAt[i] !== "U")) {
output += text.charAt[i] + "op";
} else {
output += text.charAt[i];
}
}
return output;
}
var text = prompt("Enter Text To Convert");
alert(opishConversion(text));
任何帮助,将不胜感激。
charAt
是String
基元的本机方法。应该charAt(i)
不是charAt[i]
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句