I have what I thought will be a simple task of 'toggling' a value to an array.
What I want to do is to add the row if it doesn't exist and delete if it does exist:
selected = new Array();
// repeated code
if(row in selected===true) selected.splice(row);
else selected.push(row);
Now this works fine with the exception of the first element in the array, which always remains unchanged and is apparently not recognized by the "in selected".
a) row = 1 > ["1"]
b) row = 1 > ["1", "1"]
c) row = 2 > ["1", "1", "2"]
d) row = 2 > ["1", "1"]
e) row = 1 > ["1"]
f) row = 1 > ["1", "1"]
using the values and output above you can see that "1" gets added as the first element and never removed ??