how to check if an id already exists in an array javascript code example
Example: how to check if an element already exists in an array in javascript
function includes(arrayOfArrays, item) {
let array, i, j;
for(i=0; i<arrayOfArrays.length; ++i) {
array = arrayOfArrays[i];
for(j=0; j<array.length; ++j) {
if(array[j] === item) {
return true;
}
}
}
return false;
}