📜  recorrer letra por letra js - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:57.895000             🧑  作者: Mango

代码示例1
function validarString (cadenaAnalizar) {
   for (var i = 0; i< cadenaAnalizar.length; i++) {
         var caracter = cadenaAnalizar.charAt(i);
         if( caracter == "ñ" || caracter == "Ñ") {
            alert("Caracter no permitido");
             return false;
          }  else {
             return true;
          }
    }
}