function arrayToggle(array = [], value) {
  const index = array.indexOf(value);
  if (index > -1) {
    // Remove if value is in array
    array.splice(index, 1);
  } else {
    // Add if value is NOT in array
    array.push(value);
  }
}
// This directly mutates the array.
This directly mutates the array.
This directly mutates the array .
function arrayToggle(array = [], value) {
  const index = array.indexOf(value);
  if (index > -1) {
    array.splice(index, 1);
  } else {
    array.push(value);
  }
}
function arrayToggle ( array = [ ] , value ) { const index = array . indexOf ( value ) ; if ( index > - 1 ) { array . splice ( index , 1 ) ; } else { array . push ( value ) ; } }
This directly mutates the array.
This directly mutates the array .
// Remove if value is in array // Add if value is NOT in array