Conversation
tekul
left a comment
There was a problem hiding this comment.
Good stuff Ali 👍 . No real problems with the coding 💯 . Just watch out for the names you choose for your functions. It can be difficult but try to choose a name which matches what the function does as much as possible.
| return attendance[0]; | ||
| } else { | ||
| return ""; | ||
| } |
There was a problem hiding this comment.
When you write a function for use with filter or find, it should return true or false for each input, not a string. Don't try to rely on Javascript's odd behaviour. The filter and map are two separate things so shouldn't share the same function. It's better to have something like:
var eligibleStudentNames = attendances
.filter(isEligibleStudent)
.map(studentName)
| ]; | ||
|
|
||
| var longNameThatStartsWithA = findLongNameThatStartsWithA(names); | ||
| function findLongNameThatStartsWithA(name) { |
There was a problem hiding this comment.
Since this function just checks a single value, it would be better named isLongNameThatStartsWithA. It doesn't do any finding itself. It could equally well be used with a filter call for example, so the context in which it is used shouldn't affect its name.
No description provided.