Skip to content

Commit

Permalink
Grammar fixes to lookup-table.md
Browse files Browse the repository at this point in the history
  • Loading branch information
miparnisari authored Nov 14, 2016
1 parent ab46b41 commit a6c6637
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions workflow/lookup-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ The easiest optimization is to ensure that the most common conditions are first:

```js
if (value < 5) {
// most frequency case
// most frequent case
} else if (value > 5 && value < 10) {
// second frequency case
// second most frequent case
} else {
// in other case
// other less frequent cases
}
```

Expand Down Expand Up @@ -41,7 +41,7 @@ Be careful about choosing between `Object` or `Array`:

## Caveats

Although is more readable, using a lookup table isn't always better. The cost of creating the lookup table could be higher than using a set of `if`/`else` statements. So, it depends on your code:
Although it is more readable, using a lookup table isn't always better. The cost of creating the lookup table could be higher than using a set of `if`/`else` statements. So, it depends on your code:

- If you have to handle a small set of conditions (maybe less than 3) or the code runtime life is short, use `if`/`else`.
- In other cases, use a lookup table.

0 comments on commit a6c6637

Please sign in to comment.