I have two arrays and each one contain 14 items and a main for loop (I want i in this loop to do some behaviors).
I want to assign pass variable along with iterating i in the for loop with items of values array.
Here is what I mean:
var values = [1, 3, 1, 1, 1, 1, 2, 1, 2, 1, 2, 2, 1, 3];
var indexs = [3, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18];
var pass = 0;
for (var i = 0; i < 1000; i++) {
// when i is equel to each item in "indexs" array assign "pass" with "values" item
// for example if i == 3 ===> pass = values[0] or 1
// if i == 5 ===> pass = values[1] or 3
// if i == 18 ===> pass = values[14] or 3
}
pass = values[indexs.indexOf(i)]will get the first match.