I'm struggling with a simple problem. I want to instruct a for loop to return string.charAt(i) if string.charAt(i) is not either A-Z or a-z. I'm sure there's a basic regex statement but for the world of me I can't think what it is.
It's for the final else if in this code (the first two ifs are checking against an a-z string and an A-Z string:
for (var j = 0; j < 26; j++) {
if (message.charAt(i) === lowercase.charAt(j)) {
output += (j + 13 > 26) ? (lowercase.charAt((j + 13) - 26)) : (lowercase.charAt((j + 13)));
}
else if (message.charAt(i) === uppercase.charAt(j)) {
output += (j + 13 > 26) ? (uppercase.charAt((j + 13) - 26)) : (uppercase.charAt((j + 13)));
}
else if (message.charAt(i) != XXXX) {
output += message.charAt(i);
}
}
}
Thanks for any help!