As in this function, that toggles the 'completed' state of a todo item from true to false and back:
toggle: function() {
this.save({
completed: !this.get('completed')
});
}
Assuming you know that ! means negation (converts to boolean and returns the opposite value), what you posted is the same as
!(this.get('completed'))
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence
Notice that the . comes before the ! on that table. That's why the ! is associated with the whole expression, the . gets associated with get() before the ! comes into play.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With