Skip to content

Commit 04f883d

Browse files
authored
Fix evenNumbers variable name translation
1 parent f4f1336 commit 04f883d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ With those three methods you can avoid the use of *for* and *forEach* loops in m
567567
```js
568568
const numbers = [0, 1, 2, 3, 4, 5, 6];
569569
const doubledNumbers = numbers.map(n => n * 2); // [0, 2, 4, 6, 8, 10, 12]
570-
const parNumbers = numbers.filter(n => n % 2 === 0); // [0, 2, 4, 6]
570+
const evenNumbers = numbers.filter(n => n % 2 === 0); // [0, 2, 4, 6]
571571
const sum = numbers.reduce((prev, next) => prev + next, 0); // 21
572572
```
573573

@@ -623,10 +623,10 @@ console.log(doubledNumbers); // [0, 2, 4, 6, 8, 10, 12]
623623
##### Array.prototype.filter()
624624

625625
```js
626-
const parNumbers = numbers.filter(function(n) {
626+
const evenNumbers = numbers.filter(function(n) {
627627
return n % 2 === 0; // true if "n" is par, false if "n" isn't
628628
});
629-
console.log(parNumbers); // [0, 2, 4, 6]
629+
console.log(evenNumbers); // [0, 2, 4, 6]
630630
```
631631

632632
We are using .filter on the *numbers* array, filter is iterating on each element of the array and passes it to our function. The goal of the function is to return a boolean that will determine whether the current value will be kept or not. Filter then returns the array with only the kept values.

0 commit comments

Comments
 (0)