Skip to content
This repository was archived by the owner on Aug 31, 2019. It is now read-only.

Comments

AdvancedJavaScript#7

Closed
sfmajors373 wants to merge 27 commits intobloominstituteoftechnology:masterfrom
sfmajors373:master
Closed

AdvancedJavaScript#7
sfmajors373 wants to merge 27 commits intobloominstituteoftechnology:masterfrom
sfmajors373:master

Conversation

@sfmajors373
Copy link

Hi,
Submitting for review.
Thanks!

Copy link
Contributor

@seanchen1991 seanchen1991 left a comment

Choose a reason for hiding this comment

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

Some minor comments, but looks good for the most part!

// Combine all elements into a single value going from left to right.
// Elements will be passed one by one into `cb`.
// `memo` is the starting value. If `memo` is undefined then make `elements[0]` the initial value.
if (memo === undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You can just do if (!memo) here.

}
}
if (temp.length === 0) {
return undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

If you just do return;, it's the same as doing return undefined;.

return temp;
};

const flatten = (elements) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This implementation will only strip away one level of nesting. It needs to be able to strip away an arbitrary amount of nesting.

// this method should take in a string and compare it to the object's password property
// return `true` if they match, otherwise return `false`
comparePasswords(word) {
if (word === this.password) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Here, you can just do return word === this.password;

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants