toggle an element in list javascript code example
Example: toggle an element in list javascript
//If you can use lodash library
let array=[1,2,3]
_.xor(array, [2]) //returns [1,3]
_.xor(array, [4]) //returns [1,2,3,4]
//If you can use lodash library
let array=[1,2,3]
_.xor(array, [2]) //returns [1,3]
_.xor(array, [4]) //returns [1,2,3,4]