Tip
Ember.Object has 2 helpful functions for working with integer properties. You can increment a property with
1 2 |
<em> person.incrementProperty('age');</em> |
That will increase the value of age by one. You can also increment by a custom number e.g.
To decrement, simply use
1 |
<em>decrementProperty</em> |
instead.
This is a lot nicer than
1 |
<em>person.set('age', person.get('age') + 1);</em> |
Some Love ❤❤❤
If you are enjoying my daily tips please spread the word with this one-click tweet.
If you do NOT like the tips then please reply to this email and let me know.