mirror of
https://github.com/Stone-Red-Code/website.git
synced 2026-09-04 09:15:58 +02:00
Merge pull request #219 from the-programmers-hangout/content-resources-nitpick
content(resources): nitpick in consistency
This commit is contained in:
@@ -84,7 +84,7 @@ users.forEach(user => {
|
|||||||
console.log(youngerUsers); // outputs [ { name: "John", age: 17 }, { name: "Jane", age: 16 } ]
|
console.log(youngerUsers); // outputs [ { name: "John", age: 17 }, { name: "Jane", age: 16 } ]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Modifying all elements of an array using `.map()`
|
## Modifying all elements of an array using `map()`
|
||||||
|
|
||||||
It's common to want to modify every element of an array with some logic, and `map()` makes this easy.
|
It's common to want to modify every element of an array with some logic, and `map()` makes this easy.
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ users.forEach(user => {
|
|||||||
console.log(userNames); // outputs [ "Joe", "John", "Jane" ]
|
console.log(userNames); // outputs [ "Joe", "John", "Jane" ]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Running custom logic using an array using `.reduce()`
|
## Running custom logic using an array using `reduce()`
|
||||||
|
|
||||||
`reduce()` is often less understood, but it's not that complicated once you get the basics. Itself, it takes 2 arguments, a function, and an initial value. The function takes a few arguments:
|
`reduce()` is often less understood, but it's not that complicated once you get the basics. Itself, it takes 2 arguments, a function, and an initial value. The function takes a few arguments:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user