Skip to content

Commit 8188e72

Browse files
authored
Changed const to let in es6 Array.map example
Both the counter and the result array were constants, which caused a syntax error
1 parent a44c260 commit 8188e72

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

manuscript/appendices/01_language_features.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@ In ES6 we could write it as follows:
275275

276276
```javascript
277277
function map(cb, values) {
278-
const ret = [];
279-
const i, len;
278+
let ret = [];
279+
let i, len;
280280

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

0 commit comments

Comments
 (0)