-
Notifications
You must be signed in to change notification settings - Fork 22
task complete #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
task complete #14
Conversation
| **************************************************************/ | ||
| function findFirstStringStartingWithLetter(letter, strings) { | ||
| //TODO: Add your code here | ||
| strings = strings.map((value, index, array) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You didn't have to loop over every string in the array to make them lower cased, instead you could've just done that inside the find method like so:
strings.find( (value)=> value.toLowerCase().startsWith(letter))
| strings = strings.map((value, index, array) => { | ||
| return value.toLowerCase(); | ||
| }); | ||
| console.log(strings.filter((value) => value.startsWith(letter))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're supposed to find only one item using the find method, hence the name of the function findFirst...
| function searchReviewers(query, reviewers) { | ||
| //TODO: ADD YOUR CODE HERE | ||
| query = query.toLowerCase(); | ||
| reviewers.map((element) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You didn't have to loop over the array twice to make the reviewerName & description lower cased, you could've done so directly inside the filter method, since you have the value there and you can just attach .toLowerCase to each value there.
i.e:
if (
value.reviewerName.toLowerCase().includes(query) &&
value.description.toLowerCase().includes(query)
) {
return value;
}
No description provided.