if | function isAlphaNumeric(str) {
var code, i, len;
for (i = 0, len = str.length; i < len; i++) {
code = str.charCodeAt(i);
if (!(code > 47 && code < 58) &&
!(code > 64 && code < 91) &&
!(code > 96 && code < 123)) {
return false;
}
}
return true;
};
isAlphaNumeric("AASDFWEradsgadfgdfghxcgvdfgadsfrAEWEWRAWE2345234523653456345634563456")
| ready |
else | function isAlphaNumeric(str) {
var code, i, len;
for (i = 0, len = str.length; i < len; i++) {
code = str.charCodeAt(i);
if ((code > 47 && code < 58) ||
(code > 64 && code < 91) ||
(code > 96 && code < 123)) {
}else{
return false;
}
}
return true;
};
isAlphaNumeric("AASDFWEradsgadfgdfghxcgvdfgadsfrAEWEWRAWE2345234523653456345634563456")
| ready |
regex | function isAlphaNumeric(str) {
return /^[A-Za-z0-9]+$/.test(str)
};
isAlphaNumeric("AASDFWEradsgadfgdfghxcgvdfgadsfrAEWEWRAWE2345234523653456345634563456")
| ready |
remove charCodeAt | function isAlphaNumeric(str) {
let char = "";
for (let i = 0, len = str.length; i < len; i++) {
char = str[i];
if ((char >= "0" && char <= "9") ||
(char >= "A" && char <= "Z") ||
(char >= "a" && char <= "z")) {
}else{
return false;
}
}
return true;
};
isAlphaNumeric("AASDFWEradsgadfgdfghxcgvdfgadsfrAEWEWRAWE2345234523653456345634563456")
| ready |