Skip to content

Commit 1e5d829

Browse files
authored
Merge branch 'exercism:main' into implement-error-handling-exercise
2 parents 92a7c22 + aa2b33d commit 1e5d829

File tree

62 files changed

+2443
-3188
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+2443
-3188
lines changed

.github/workflows/ci.js.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-24.04
1414

1515
steps:
16-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
16+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
1717
- name: Enable corepack to fix https://github.com/actions/setup-node/pull/901
1818
run: corepack enable pnpm
1919

@@ -37,7 +37,7 @@ jobs:
3737
node-version: [22.x]
3838

3939
steps:
40-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
40+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
4141
- name: Enable corepack to fix https://github.com/actions/setup-node/pull/901
4242
run: corepack enable pnpm
4343

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
steps:
3131
- name: Checkout repository
32-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
32+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
3333

3434
# Initializes the CodeQL tools for scanning.
3535
- name: Initialize CodeQL

.github/workflows/pr.ci.js.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111

1212
steps:
1313
- name: Checkout PR
14-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
14+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
1515
with:
1616
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}
1717

@@ -48,7 +48,7 @@ jobs:
4848

4949
steps:
5050
- name: Checkout PR
51-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
51+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
5252
with:
5353
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}
5454

.github/workflows/verify-code-formatting.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-24.04
1111
steps:
1212
- name: 'Checkout code'
13-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
13+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
1414

1515
- name: 'Verify formatting of all files'
1616
run: ./bin/check-formatting.sh

concepts/callbacks/about.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ You see this pattern often when dealing with asynchronous functions to assist wi
8181
Common `Array` functions use callback functions to define their behaviour:
8282

8383
- `Array.prototype.forEach`:
84-
8584
- Accepts a callback, which applies the callback to each element of an array.
8685

8786
```javascript
@@ -92,7 +91,6 @@ Common `Array` functions use callback functions to define their behaviour:
9291
```
9392

9493
- `Array.prototype.map`
95-
9694
- Accepts a callback, which applies the callback to each element of an array using the result to create a new array.
9795

9896
```javascript
@@ -103,7 +101,6 @@ Common `Array` functions use callback functions to define their behaviour:
103101
```
104102

105103
- `Array.prototype.reduce`
106-
107104
- Accepts a callback, which applies the callback to each element of an array, passing the result forward to the next invocation.
108105

109106
```javascript

concepts/closures/about.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ The name _closure_ is historically derived from [_λ-calculus_][wiki-lambda-calc
1818
## Reasons to use closures in JavaScript
1919

2020
1. Data Privacy / Data Encapsulation
21-
2221
- 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).
2322

2423
```javascript
@@ -37,7 +36,6 @@ The name _closure_ is historically derived from [_λ-calculus_][wiki-lambda-calc
3736
```
3837

3938
2. Partial Application
40-
4139
- 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.
4240

4341
```javascript

concepts/closures/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ twoDozen;
1818
// => Uncaught ReferenceError: twoDozen is not defined
1919
```
2020

21-
Except for braces `{}`, functions (and classes) als create new scopes, which can _enclose_ values:
21+
Except for braces `{}`, functions (and classes) also create new scopes, which can _enclose_ values:
2222

2323
```javascript
2424
const dozen = 12;

exercises/concept/amusement-park/.meta/design.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,22 @@ This exercise could benefit from the following rules in the [analyzer][analyzer]
3232
The comment types mentioned below only serve as a proposal.
3333

3434
1. `createVisitor`
35-
3635
- `actionable`: If the student used a helper variable, give feedback that the result can be returned directly.
3736
- `celebratory`: If the student used classes, celebrate but let them know it is not necessary throughout this exercise.
3837
- `informative`: If the student did not use the short-hand notation but wrote `name: name` etc instead, let them know how to shorten that.
3938
The solution should be accepted nevertheless.
4039

4140
2. `revokeTicket`
42-
4341
- `essential`: Check the ticketId field is not deleted and re-added.
4442
- `celebratory`: If they used a method on a visitor class, celebrate but let them know it is not necessary for this exercise.
4543

4644
3. `ticketStatus`
47-
4845
- `essential`: Using a type switch should be discouraged since it is confusing to read because of the `typeof null === 'object'` quirk.
4946
- `informative`: If the student did not use early returns, maybe let them know about this alternative.
5047
- `celebratory`: Congratulate if the student used a template string for the "sold" case
5148
- `celebratory`: Congratulate if the student used a `value` helper variable.
5249

5350
4. `simpleTicketStatus`
54-
5551
- `essential`: Check `??` was used and not an if-statement or something else.
5652
- `actionable`: If the student used a helper variable, give feedback that the result can be returned directly.
5753

exercises/concept/bird-watcher/.docs/instructions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ To practice, use a `for` loop to solve each of the tasks below.
1616
Let us start analyzing the data by getting a high-level view.
1717
Find out how many birds you counted in total since you started your logs.
1818

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.
2020
It should return the total number of birds that you counted.
2121

2222
```javascript
@@ -29,7 +29,7 @@ totalBirdCount(birdsPerDay);
2929

3030
Now that you got a general feel for your bird count numbers, you want to make a more fine-grained analysis.
3131

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.
3333
It returns the total number of birds that you counted in that specific week.
3434
You can assume weeks are always tracked completely.
3535

@@ -46,7 +46,7 @@ You figured out that this bird always spent every second day in your garden.
4646
You do not know exactly where it was in between those days but definitely not in your garden.
4747
Your bird watcher intuition also tells you that the bird was in your garden on the first day that you tracked in your list.
4848

49-
Given this new information, write a function `fixBirdCountLog` that takes an array of 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.
5050

5151
```javascript
5252
birdsPerDay = [2, 5, 0, 7, 4, 1];

exercises/concept/bird-watcher/.meta/design.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,16 @@ This exercise could benefit from the following rules in the [analyzer][analyzer]
3636
For all tasks check that the student actually used a for loop.
3737

3838
1. `totalBirdCount`
39-
4039
- Verify that the condition is written with `< x.length` instead of `<= y.length -1`.
4140
- Check whether a shorthand assignment `+=` was used to increase the sum (non-essential feedback).
4241
- Verify the total was properly initialized with `0` instead of e.g. `null`
4342
- Verify the increment operator was used in loop header step
4443

4544
2. `birdsInWeek`
46-
4745
- Verify a helper variable was used instead of duplicating the calculation in the initialization and condition of the loop
4846
- Other checks should be the same as for `totalBirdCount`
4947

5048
3. `fixBirdCountLog`
51-
5249
- Check whether a shorthand assignment `+=` was used to increase the loop counter (non-essential feedback)
5350
- Check whether the increment operator was used in the loop body
5451

0 commit comments

Comments
 (0)