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: exercises/concept/train-driver/.docs/instructions.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ Uh-oh. some wagons seem to have gone missing.
43
43
Fortunately, your friend just found another `array` which appears to contain the missing wagon IDs, and would like you to add them into the main wagon ID `array`.
44
44
All they can remember is that the missing values should be placed directly after the designated locomotive.
45
45
46
-
Given this new information, write a function called `CorrectListOfWagons` that takes two arrays which have the IDs of each wagon as the arguments.
46
+
Given this new information, write a function called `CorrectListOfWagons` that takes two arrays which have the IDs of each wagon as the arguments.
47
47
The wagon IDs of the second `array` should be added into the first `array` directly after the locomotive (ID 1).
48
48
49
49
```javascript
@@ -70,8 +70,8 @@ The variable `moreRouteInformation` can contain different properties.
// => {from: "Berlin", to: "Hamburg", length: "100", speed: "50"}
77
77
```
@@ -85,11 +85,11 @@ Implement a function `separateArrivalTime` that accepts an object with the routi
85
85
The function should return an array there the first element of the array is the arrival time and the second element is an object with the routing information without arrival time.
86
86
87
87
```javascript
88
-
routeInformation= {
88
+
routeInformation= {
89
89
from:"Berlin",
90
90
to:"Hamburg",
91
91
length:"100",
92
-
timeOfArrival:"10:10"
92
+
timeOfArrival:"10:10",
93
93
};
94
94
separateTimeOfArrival(routeInformation);
95
95
// => ["10:10", {from: "Berlin", to: "Hamburg", length: "100"}]
Copy file name to clipboardExpand all lines: exercises/concept/train-driver/.meta/design.md
+12-49Lines changed: 12 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,60 +2,23 @@
2
2
3
3
## Learning objectives
4
4
5
-
-What does a for loop do
6
-
-Syntax `for(...){...}`
7
-
-What are the different parts of the for loop header
8
-
-How to iterate over an array with a for loop
9
-
-What is the increment/decrement operator `i++`/`i--`
5
+
-Using spread to turn an array into a list of parameters
6
+
-Using rest elements to turn a list of parameters into an array
7
+
-Using spread to turn an extract value out of an object
8
+
-Using spread to combine objects
9
+
-Using rest to collect multiple parameters into an array
10
10
11
-
## Out of Scope
11
+
## Out of scope
12
12
13
-
The following topics are out of scope because they are covered by another concept exercise.
14
-
15
-
- Other loops like `while`
16
-
- Other possibilities of iterating over an array
17
-
-`break` and `continue` are only mentioned in the about.md file here because they will be more in focus in the `while` exercise
13
+
- Default values
18
14
19
15
## Concepts
20
16
21
-
The Concepts this exercise unlocks are:
22
-
23
-
-`for-loops`
24
-
-`increment-decrement`
17
+
-`rest-and-spread`
25
18
26
19
## Prerequisites
27
20
28
-
-`arrays` because they are used to iterate over them in the exercise
29
-
-`comparison` for writing the condition in the loop header
30
-
-`conditionals` because they introduced the student to the concept of conditional execution
31
-
32
-
## Analyzer
33
-
34
-
This exercise could benefit from the following rules in the [analyzer][analyzer]:
35
-
36
-
For all tasks check that the student actually used a for loop.
37
-
38
-
1.`totalBirdCount`
39
-
40
-
- Verify that the condition is written with `< x.length` instead of `<= y.length -1`.
41
-
- Check whether a shorthand assignment `+=` was used to increase the sum (non-essential feedback).
42
-
- Verify the total was properly initialized with `0` instead of e.g. `null`
43
-
- Verify the increment operator was used in loop header step
44
-
45
-
2.`birdsInWeek`
46
-
47
-
- Verify a helper variable was used instead of duplicating the calculation in the initialization and condition of the loop
48
-
- Other checks should be the same as for `totalBirdCount`
49
-
50
-
3.`fixBirdCountLog`
51
-
52
-
- Check whether a shorthand assignment `+=` was used to increase the loop counter (non-essential feedback)
53
-
- Check whether the increment operator was used in the loop body
54
-
55
-
## Notes
56
-
57
-
The exercise is inspired by [Bird Watcher Exercise in the C# track][csharp-bird-watcher] but the original exercise included more concepts and subsequently also tasks that cover all of these concepts.
58
-
Since the exercise for the JavaScript track should be focussed on the for loop, the tasks where reduced and changed accordingly.
0 commit comments