Skip to content

Commit

Permalink
Changed const to let in es6 Array.map example
Browse files Browse the repository at this point in the history
Both the counter and the result array were constants, which caused a syntax error
  • Loading branch information
skarlinski authored Feb 25, 2018
1 parent a44c260 commit 8188e72
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions manuscript/appendices/01_language_features.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ In ES6 we could write it as follows:

```javascript
function map(cb, values) {
const ret = [];
const i, len;
let ret = [];
let i, len;

for(i = 0, len = values.length; i < len; i++) {
ret.push(cb(values[i]));
Expand Down

0 comments on commit 8188e72

Please sign in to comment.