Skip to content

Commit

Permalink
Add missing word
Browse files Browse the repository at this point in the history
This PR adds a missing "how" to the description of the iteration helpers' behavior. 

"Each of these helpers accepts a function callback to apply to each element in the array, differing only in *how* they respectively respond to a return value from the callback."
  • Loading branch information
regularmike authored Jul 12, 2016
1 parent a252143 commit 896eeb4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion this & object prototypes/ch3.md
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ for (var i = 0; i < myArray.length; i++) {

This isn't iterating over the values, though, but iterating over the indices, where you then use the index to reference the value, as `myArray[i]`.

ES5 also added several iteration helpers for arrays, including `forEach(..)`, `every(..)`, and `some(..)`. Each of these helpers accepts a function callback to apply to each element in the array, differing only in they respectively respond to a return value from the callback.
ES5 also added several iteration helpers for arrays, including `forEach(..)`, `every(..)`, and `some(..)`. Each of these helpers accepts a function callback to apply to each element in the array, differing only in how they respectively respond to a return value from the callback.

`forEach(..)` will iterate over all values in the array, and ignores any callback return values. `every(..)` keeps going until the end *or* the callback returns a `false` (or "falsy") value, whereas `some(..)` keeps going until the end *or* the callback returns a `true` (or "truthy") value.

Expand Down

0 comments on commit 896eeb4

Please sign in to comment.