You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: concepts/closures/about.md
-2Lines changed: 0 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,6 @@ The name _closure_ is historically derived from [_λ-calculus_][wiki-lambda-calc
18
18
## Reasons to use closures in JavaScript
19
19
20
20
1. Data Privacy / Data Encapsulation
21
-
22
21
- Unlike other languages, in 2020, there was no way to specify _private_ variables. So closures can be used to effectively emulate _private_ variables (there was a proposal to introduce private variable notation, which might have become standard by the time you read this).
23
22
24
23
```javascript
@@ -37,7 +36,6 @@ The name _closure_ is historically derived from [_λ-calculus_][wiki-lambda-calc
37
36
```
38
37
39
38
2. Partial Application
40
-
41
39
- Functions may return functions, and when a returned function uses the argument of the function that created it, this is an example of using a closure to perform partial application. Sometimes this is called _currying_ a function.
Copy file name to clipboardExpand all lines: exercises/concept/bird-watcher/.docs/instructions.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ To practice, use a `for` loop to solve each of the tasks below.
16
16
Let us start analyzing the data by getting a high-level view.
17
17
Find out how many birds you counted in total since you started your logs.
18
18
19
-
Implement a function `totalBirdCount` that accepts an array that contains the bird count per day.
19
+
Implement a function `totalBirdCount` that accepts an array-like object that contains the bird count per day.
20
20
It should return the total number of birds that you counted.
21
21
22
22
```javascript
@@ -29,7 +29,7 @@ totalBirdCount(birdsPerDay);
29
29
30
30
Now that you got a general feel for your bird count numbers, you want to make a more fine-grained analysis.
31
31
32
-
Implement a function `birdsInWeek` that accepts an array of bird counts per day and a week number.
32
+
Implement a function `birdsInWeek` that accepts an array-like object of bird counts per day and a week number.
33
33
It returns the total number of birds that you counted in that specific week.
34
34
You can assume weeks are always tracked completely.
35
35
@@ -46,7 +46,7 @@ You figured out that this bird always spent every second day in your garden.
46
46
You do not know exactly where it was in between those days but definitely not in your garden.
47
47
Your bird watcher intuition also tells you that the bird was in your garden on the first day that you tracked in your list.
48
48
49
-
Given this new information, write a function `fixBirdCountLog` that takes an arrayof birds counted per day as an argument. It should correct the counting mistake and return the modified array.
49
+
Given this new information, write a function `fixBirdCountLog` that takes an array-like object of birds counted per day as an argument. It should correct the counting mistake by modifying the given array.
0 commit comments