Skip to content
This repository was archived by the owner on Jan 14, 2024. It is now read-only.

Commit a2af7c3

Browse files
authored
Add missing expected results to exercises and fix typos (#1)
1 parent 634e427 commit a2af7c3

File tree

5 files changed

+40
-26
lines changed

5 files changed

+40
-26
lines changed

1-exercises/A-array-find/exercise.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
You are given an array of names.
33
Using .find(), we'd like to find the first name which starts with A and is longer than 7 letters.
44
*/

1-exercises/D-array-filter/exercise.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,8 @@ let pairs = pairsByIndex.map(function (indexes) {
2020
});
2121

2222
console.log(pairs);
23+
24+
/* EXPECTED RESULT
25+
26+
[ [ 'Islam', 'Luke' ], [ 'Lesley', 'Mozafar' ], [ 'Harun', 'Irina' ] ]
27+
*/

1-exercises/E-array-map/exercise.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,12 @@
22
// Write multiple solutions using different syntax (as shown in the README)
33

44
let numbers = [0.1, 0.2, 0.3, 0.4, 0.5];
5+
6+
let numbersMultipliedByOneHundred; // complete this statement
7+
8+
console.log(numbersMultipliedByOneHundred);
9+
10+
/* EXPECTED RESULT
11+
12+
[10, 20, 30, 40, 50]
13+
*/

2-mandatory/2-oxygen-levels.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/*
22
Many years into the future, a team of Space Voyagers find their ship is low on Oxygen and need to dock
33
somewhere safe while they call home for help.
4-
4+
55
Their computer detects a list of nearby planets that have Oxygen in their atmosphere.
66
77
To be safe, they need to land on the first unnamed planet that has Oxygen levels between 19.5% and 23.5%.
88
99
Write a function that finds the oxygen level of the first safe planet - Oxygen between 19.5% and 23.5%
1010
11-
Some string methods that might help you here are .replace() and .substring().
11+
Some string methods that might help you here are .replace() and .substring().
1212
*/
1313

1414
function findSafeOxygenLevel() {}
@@ -33,6 +33,6 @@ test("findSafeOxygenLevel function filters out invalid percentages", () => {
3333
).toEqual("21.1%");
3434
});
3535

36-
test("findSafeOxygenLevel function returns undefined if no valid plants found", () => {
36+
test("findSafeOxygenLevel function returns undefined if no valid planets found", () => {
3737
expect(findSafeOxygenLevel(["50"])).toBeUndefined();
3838
});

2-mandatory/6-journey-planner.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
/*
2-
Before we go the big story; we will introduce more string methods.
3-
Some of the methods you're using in Array have similar ones with strings.
4-
Methods like : IndexOf, Include, Search, Slice , Spilt and more.
5-
6-
You can always google how a method of a string works!
2+
Before we go to the big story, we will introduce some more string methods.
3+
Some of the methods you're using on arrays are similar to ones you can use on strings.
4+
Methods like: IndexOf, Include, Search, Slice , Spilt and more.
5+
6+
You can always Google how a method of a string works!
77
Here are links to some of those:
88
- https://www.w3schools.com/js/js_string_methods.asp
99
- https://javascript.info/string#quotes
1010
Now let's do this small exercise
11-
11+
1212
Using string methods update the checkCodeIsThere() function
1313
- The function will have a string as a paramter
14-
- The function should check if the string has the word "code" exists in the string
14+
- The function should check if the word "code" exists in the string
1515
- If it does exist, return the index of it, if not return "Not found"
1616
1717
Hint: search for string methods like Includes and IndexOf.
@@ -32,27 +32,27 @@ function checkCodeIsThere(stringText) {
3232
The input provided contains a list of locations in London. Each of locations is followed by a list
3333
of transport modes that can be used to get there.
3434
Let's see an example:
35-
36-
To take to Tower Bridge, you can use tube or river boat. This information will represented as
35+
36+
To take to Tower Bridge, you can use tube or river boat. This information will represented as
3737
["Tower Bridge", "tube", "river boat"]
3838
3939
Where
4040
the 1st element says the name of the location,
41-
and rest of them says the transport modes.
41+
and rest of them say the transport modes.
4242
43-
You will then get a list of these information, e.g:
43+
You will then get a list of this information, e.g:
4444
[
4545
["Tower Bridge", "tube", "river boat"],
4646
["Abbey road", "double decker"],
4747
["London Eye", "tube", "river boat", "bus"]
4848
]
4949
50-
You have to finish up the body of journeyPlanner function that should tell where I can go if I only
50+
You have to finish up the body of journeyPlanner function that should tell me where I can go if I only
5151
want to use a specific mode of transport. But before jumping straight to the main function, we will
5252
break down the whole task into smaller steps that make our job easier.
5353
54-
This technic is also referred as "problem decomposition". It helps you to reduce scope of the problem
55-
by only focusing on a small chunk of the whole problem at a time.)
54+
This technique is also referred to as "problem decomposition". It helps you to reduce the scope of the problem
55+
by only focusing on a small chunk of the whole problem at a time.
5656
*/
5757

5858
/*
@@ -61,7 +61,7 @@ function checkCodeIsThere(stringText) {
6161
e.g: ["Tower Bridge", "tube", "river boat"]
6262
- Returns an array including the available transport modes to the given location
6363
e.g: ["tube", "river boat"]
64-
64+
6565
Hint: Use the corresponding array method to split the array.
6666
*/
6767
function getTransportModes() {}
@@ -74,12 +74,12 @@ function getTransportModes() {}
7474
e.g: ["tube", "river boat"]
7575
2) Second parameter is a string containing a transport mode
7676
e.g: "river boat"
77-
78-
- Returns
77+
78+
- Returns
7979
* True if the location in the first parameter is accessible by the transport mode given in second parameter
8080
* Otherwise, returns false
81-
82-
Hint: Use the corresponding array method to decide if an element is member of an array.
81+
82+
Hint: Use the corresponding array method to decide if an element is included in an array.
8383
*/
8484
function isAccessibleByTransportMode() {}
8585

@@ -113,12 +113,12 @@ function getLocationName() {}
113113
- Returns an array of where I can go if I only want to use a specific mode of transport.
114114
115115
NOTE: only the location names should be returned, not the name of transports.
116-
116+
117117
HINTS:
118118
- Use the function you implemented above.
119-
- Use array method to remove locations that is not accessible by the given transportMode.
119+
- Use array method to remove locations that are not accessible by the given transportMode.
120120
- Use array method to manipulate its elements.
121-
121+
122122
Advanced challange: try to use arrow function when invoking an array method.
123123
*/
124124
function journeyPlanner(locations, transportMode) {

0 commit comments

Comments
 (0)