Skip to content

Week 3#54

Open
Nabraha wants to merge 11 commits intorarmatei:masterfrom
Nabraha:week-3
Open

Week 3#54
Nabraha wants to merge 11 commits intorarmatei:masterfrom
Nabraha:week-3

Conversation

@Nabraha
Copy link

@Nabraha Nabraha commented Mar 26, 2019

No description provided.

Copy link
Collaborator

@tekul tekul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test this? Running it gives me:

$ node boats.js 
[]

}

function studentNameWhoAttendedAtLeast8Classes(studentName){
return studentName[0];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure I will commit the change


// -- Complete this function -->
function findLongNameThatStartsWithA(names) {}
function findLongNameThatStartsWithA(names) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 🙂 .

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure I will commit the change


// -- Complete this function -->
function hasOnlyStudents() {}
function hasOnlyStudents(studentName) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

// - logging the output to the console

var numbs = [10, 20, 30];
var numbsDoubled = numbs.map(multiplyBy100);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

numbsDoubled implies they are multiplied by 2 not 100 🙂 .

console.log("Buzz");
} else {
console.log(num);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants