Why are you collapsing this lines ?  In that case is better to use a ternary operator ( checked ) ? this.select(values) : this.deselect(values);