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*/
6767function 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*/
8484function 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*/
124124function journeyPlanner ( locations , transportMode ) {
0 commit comments