-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest1.js
31 lines (25 loc) · 915 Bytes
/
test1.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function checkPreviousConfigs(banks, allPreviousConfigs) {
var checkTrue = false;
//moving banks to String value (currentConfig)
var currentConfig = "";
for (var i = 0; i < banks.length; i++) {
currentConfig = currentConfig + banks[i].toString();
console.log(currentConfig);
}
console.log("currentConfig " + currentConfig);
//checking previous config has the same config
for (var z = 0; z < allPreviousConfigs.length; z++) {
if (currentConfig == allPreviousConfigs[z]) {
console.log("There is a match: " + allPreviousConfigs[z]);
checkTrue = true;
break;
} else {
console.log("No match: " + allPreviousConfigs[z]);
}
}
return checkTrue;
}
var banks = [0,2,7,0];
allPreviousConfigs = ['1301', '2421', '1100', '3344', '0270', '6543'];
var x = checkPreviousConfigs(banks, allPreviousConfigs);
console.log("result: " + x);