I have two arrays of strings in vmware orchestrator, a and b.
I want to push all strings from a EXCEPT those that are also found in b into a new third array, c. So b is an array that contains exclusions.
I found some code from this site which I tried but it did not work as intended.
var c = new Array();
if (b.length == 0) {
var c = a
} else
for (i = 0; i < a.length; i++) {
for (j = 0; j < b.length; j++) {
if (b[j] != a[i]) {
c.push(a[i]);
}
}
}
So in the above example. if b contains nothing then it goes ahead and make c indentical to a.
a contains three values, Test, Test2 and Test3.
If b contains Test it will add all but this into c. (c = Test2 and Test3)
Now to the problem. If b contains Test and Test2, it will NOT exclude both, instead c will contain Test, Test 2, Test3 and Test3. I want it to contain just Test3 at this stage.