我编写的这段代码有什么问题?

脆皮

我试图使所有常量都在它们旁边,但是没有任何作用。这是这里的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));

任何帮助,将不胜感激。

亚当

charAtString基元的本机方法应该charAt(i)不是charAt[i]

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章