Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7b48a0b

Browse files
committed
fixed week5 review
1 parent cb27d56 commit 7b48a0b

File tree

5 files changed

+24
-61
lines changed

5 files changed

+24
-61
lines changed

Week5/REVIEW.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,20 @@ This review covers:
77
• JSON
88
• Map and filter
99
• Arrow functions
10-
```
10+
```
11+
12+
## Array Manipulations
13+
14+
As we know by now, arrays are collections of values.
15+
16+
As we will see, there are often many ways to achieve the same thing when working arrays. Over time, you will add different techniques to your mental toolbox to achieve the result you want quickly.
17+
18+
[Read more...](assets/array_manipulation)
19+
20+
## Map and filter
21+
22+
The array methods **map()** and **filter()** are best understood by looking at how they could be implemented if we were to write them ourselves. In the next few sections we will present simplified versions of the native implementations. We have prefixed the method names with `my` to distinguish them from the built-in versions.
23+
24+
[Read more...](assets/map_filter.md)
25+
26+

Week5/REVIEW3.md

Lines changed: 0 additions & 45 deletions
This file was deleted.

Week6/REVIEW6.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

fundamentals/array_manipulation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Array Manipulation
1+
# Array Manipulations
22

33
[MDN on Arrays](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)
44
As we know by now, arrays are collections of values.

fundamentals/map_filter.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Map, filter
22

3-
The array methods **map()**, **filter()** and **reduce()** are best understood by looking at how they could be implemented if we were to write them ourselves. In the next few sections we will present simplified versions of the native implementations. We have prefixed the method names with `my` to distinguish them from the built-in versions.
3+
The array methods **map()** and **filter()** are best understood by looking at how they could be implemented if we were to write them ourselves. In the next few sections we will present simplified versions of the native implementations. We have prefixed the method names with `my` to distinguish them from the built-in versions.
44

5-
Each of the three methods use a `for` loop internally. You will notice that once you start using these methods the need for `for` loops in your own code is greatly reduced (hurray!).
5+
Each of the three methods use a `for` loop internally. You will notice that once you start using these methods the need for `for` loops in your own code is greatly reduced (hurray!).
66

77
## Array#map()\*
88

9-
The **map** method returns a new array where each element of the subject array is transformed by a user-supplied transformation (= _mapping_) function.
9+
The **map** method returns a new array where each element of the subject array is transformed by a user-supplied transformation (= _mapping_) function.
1010

1111
```js
1212
Array.prototype.myMap = function (mapFn) {
@@ -20,7 +20,7 @@ Array.prototype.myMap = function (mapFn) {
2020

2121
<small>\* Array#map is a short-hand notation for Array.prototype.map.</small>
2222

23-
Because the **map()** method is called on an array (using dot-notation), the value of `this` refers to that array itself (in this review called the _subject_ array).
23+
Because the **map()** method is called on an array (using dot-notation), the value of `this` refers to that array itself (in this review called the _subject_ array).
2424

2525
Internally, the **map()** method initializes a new, empty array to which it will push transformed elements, one by one, as it iterates through the subject array, calling the `mapFn` function for each individual element. When the loop has been completed, the new array is returned. Note that the subject array itself remains unmodified.
2626

@@ -68,7 +68,7 @@ As is usual in JavaScript you do not necessarily have to use all the parameters
6868

6969
## Array#filter()
7070

71-
The **filter()** method returns a new array with all elements that pass the test implemented by a user-supplied (predicate\*) function.
71+
The **filter()** method returns a new array with all elements that pass the test implemented by a user-supplied (predicate\*) function.
7272

7373
```js
7474
Array.prototype.myFilter = function (predicateFn) {
@@ -132,7 +132,7 @@ The whole process is visualised in the figure below (the term _bucket_ was used
132132

133133
![image](assets/reduce-bucket.png)
134134

135-
The **reduce()** method is the most flexible of the map/filter/reduce triplet. In fact, it is possible to rewrite **map()** and **filter** using **reduce()**.
135+
The **reduce()** method is the most flexible of the map/filter/reduce triplet. In fact, it is possible to rewrite **map()** and **filter** using **reduce()**.
136136

137137
### Using reduce() to filter
138138

0 commit comments

Comments
 (0)