Skip to content

Commit

Permalink
docs(readme): Add note about operator precedence
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahdayan committed Mar 14, 2018
1 parent ea6cc75 commit 553830f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ All transformative operations return a Dinero instance, so you can chain methods
Dinero({ amount: 500 }).add(Dinero({ amount: 500 })).multiply(4)
```

**Note:** because method calls are executed sequentially, mathematical operator precedence doesn't apply. When you execute the code above, the addition happens before the multiplication, evaluating to `4000`, while `500 + 500 * 4` would normally evaluate to `2500`. If you need to perform an operation before another, make sure you call it first.

You can ask all kinds of questions to your Dinero instance. You'll get a `Boolean` in return:

```js
Expand Down

0 comments on commit 553830f

Please sign in to comment.