JavaScript–toggling an item in a list with xor
I had a problem where I wanted to either remove an item from a list if it existed or add it to the list if it did not exist. A use case for this might be selecting which day(s) of the week you want: Behind the scenes, you might store this as a simple array: … [Read more…]