I need to run conditions for each of the 4 letters, then store the opposite of it in the mRNA variable. A & T and C & G. I can't figure out how to run multiple if statements at the same time and do a separate thing for each one.
function findAcids() {
//Converts all lowercase letters to uppercase
var input = document.getElementById("inputBox").value
var abc = ["B", "D", "E", "F", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S","U", "V", "W", "X", "Y", "Z"]
input = input.toUpperCase()
document.getElementById("inputBox").value = input
//Returning errors if user input isn't A, C, G, or T
if (input.indexOf('A') > -1 || input.indexOf('T') > -1 || input.indexOf('C') > -1 || input.indexOf('G') > -1 ){
console.log("No errors occurred")
}
if (input.search(/[^a-zA-Z]+/) != -1) {
console.log("Didn't have A, T, C, G")
return 1;
}
for (var i =0; i < abc.length; i++) {
if(input.indexOf(abc[i]) > -1) {
console.log("Didn't have A, T, C, G")
return 1;
}
}
//Convert A, T, C, G to mRNA
var mRNA = ""
for (var x = 0; x < input.length; x++) {
if (input.includes('A') == true || input.includes('C') == true || input.includes('G') == true || input.includes('T') == true) {
mRNA +=
}
else {
console.log("Error: unknown error occurred while finding mRNA")
return 1;
}
}
document.getElementById("mRNA").innerHTML = mRNA
}
I tried to run a if statement for each letter, and if that if statement wasn't true, move on to the next one, however, this results in the first letter that becomes true to only print that for the other letters.