I am so lost. I think I should be using for loops to pull back the data but unsure of really where to start.
Basically, I want conditional logic to run against 3 arrays. That logic is: if var web ==“Y” && var audit == “AP.PEND” bring back var user else if var web==“N” && var audit== “INITCOMP” bring back var user. All 3 variables are arrays.
I think I have all the pieces but just not sure how to put them all together.
Any help would be appreciated!
var web = array 1;
var audit = array 2;
var user = array 3;
if (web =="Y" && audit == "AP.PEND")
{ user;
}
else
{ if (web=="N" && audit== "INITCOMP")
{ user;
}
for (i=0; i < web.length; i++) {
web;
}
for (i=0; i < audit.length; i++) {
audit;
}
for (i=0; i < user.length; i++) {
user;
}
Not sure how to show you the arrays. I am pulling from tables that I cannot “see” which is why I think I am struggling so much. I understand how to do the if/else for loops when I can see or know the data in the array but in this instance the only thing I know is to look for the value provided in array 1 and array 2. Then if that matches return the value in array 3 that would correlate.
I have attached a screenshot of the data that I can see. It is sample data. I did have to black out some of it.
if I may give some advice that you did not ask for…
If you use the code above, you will halt your learning.
That is of course up to you, but if you hope to learn enough JS, you may want to ignore the previous post until you are done with this exercise yourself.