I want to have a simple array of values, ie
var simpleArray = [\"SE1\",\"SE2\",\"SE3\"];
I want to check this array when an action happens (a c
Also if the value is an object:
const eq = (a, b) => a == b
const toggle = (arr, item) => {
const resultArray = [];
let duplicate = false;
for(let i = 0; i < arr.length; i++) {
if(!eq(arr[i], item)) {
resultArray.push(arr[i]);
} else {
duplicate = true
}
}
if(!duplicate) {
resultArray.push(item)
}
return resultArray;
}