Conversation
tekul
left a comment
There was a problem hiding this comment.
Good work 👍 . Choosing good names for functions and variables is important for real programs (and is often quite hard) so try to think about it when you're coding.
| return area[0]; | ||
| } | ||
| } | ||
| var stationsWithRiverBoat = stationTransportOptionsPairs.filter(transportation); // <-- Complete this statement |
There was a problem hiding this comment.
Did you test this? Running it gives me:
$ node boats.js
[]
week-3-practise/level-2/2-map.js
Outdated
| } | ||
|
|
||
| function studentNameWhoAttendedAtLeast8Classes(studentName){ | ||
| return studentName[0]; |
There was a problem hiding this comment.
I would just call this function studentName and call the parameter student. All it does is get the name from the student data. It doesn't have anything to do with the number of classes attended.
|
|
||
| // -- Complete this function --> | ||
| function findLongNameThatStartsWithA(names) {} | ||
| function findLongNameThatStartsWithA(names) { |
There was a problem hiding this comment.
This is written as a predicate function which just checks the required conditions for a single name. So findLongNameThatStartsWithA is no longer a good choice of name since it doesn't do any finding itself. Similarly the parameter called names is actually only a single name so should be renamed 🙂 .
|
|
||
| // -- Complete this function --> | ||
| function hasOnlyStudents() {} | ||
| function hasOnlyStudents(studentName) { |
There was a problem hiding this comment.
How is this function used below (line 14). Is it passed a single studentName?. Given how it is used does the logic here make sense.
There was a problem hiding this comment.
My understanding here:
the group [ ], must be defined before using it. in this case it was declared on line 14 and I used evey() method and called my function right after line 14.
There was a problem hiding this comment.
My mistake I think. I was looking at the original line 14 which calls the function passing in groups. If you rewrite it this way though you should rename the function hasOnlyStudents to something more appropriate (like isStudent(name)) since it is again only checking a single value. The original version was intended to check whether a group of names "has only students". This one checks whether a name "is a student".
| - Finish the statement on line 10 to produce an array with valid content | ||
| - Do not edit any of the other existing code | ||
| */ | ||
| function valuesBreaksYourCode(element) { |
There was a problem hiding this comment.
The function name here implies that the value breaks the code. In fact it is checking if the value is valid, so it would be better named isValidPair.
week-3/E-array-map/exercise.js
Outdated
| // - logging the output to the console | ||
|
|
||
| var numbs = [10, 20, 30]; | ||
| var numbsDoubled = numbs.map(multiplyBy100); |
There was a problem hiding this comment.
numbsDoubled implies they are multiplied by 2 not 100 🙂 .
| console.log("Buzz"); | ||
| } else { | ||
| console.log(num); | ||
| } |
No description provided.