Skip to content

Commit

Permalink
Merge pull request getify#85 from nickolaos77/fix-typo
Browse files Browse the repository at this point in the history
Fixed typo
  • Loading branch information
getify authored Mar 24, 2017
2 parents f9630a0 + ed30172 commit 274bf24
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ch5.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ The correct answer is: not at all. If you're not sure whether `foo()`, `bar()`,

In other words, the final `console.log(x)` is impossible to analyze or predict unless you've mentally executed the whole program up to that point.

Guess who's good at running your program? The JS engine. Guess who's not as good at running your program? The reader of your code. And yet, your choice to write code with (potentially) side effects in one or more of those function calls means that you've burdened the reader with having to mentally execute your program in its entirety up to a certain line, for them to understand to understand that line.
Guess who's good at running your program? The JS engine. Guess who's not as good at running your program? The reader of your code. And yet, your choice to write code with (potentially) side effects in one or more of those function calls means that you've burdened the reader with having to mentally execute your program in its entirety up to a certain line, for them to understand that line.

If `foo()`, `bar()`, and `baz()` were all free of side effects, they could not affect `x`, which means we do not need to execute them to mentally trace what happens with `x`. This is less mental tax, and makes the code more readable.

Expand Down

0 comments on commit 274bf24

Please sign in to comment.