Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Aug 31, 2019. It is now read-only.

Conversation

@bluebackground
Copy link

First set of complete answers.

Copy link
Contributor

@ryan-hamblin ryan-hamblin left a comment

Choose a reason for hiding this comment

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

Overall things are looking pretty good. I would suggest coming back and plowing through the extra credit. Also there are many line breaks where there don't need to be, and as for me, (this being a stylistic preference) I would return the PR and ask you to fix those line breaks. But that's not the case for everyone's style. Overall you're doing great. Keep it up. Keep plowing through the complicated stuff! It's not easy!

// declare result array object to be returned.
const result = [];
// loop over the elements
for (let i = 0; i < elements.length; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You're good to reuse your .each() method here. Maybe you could give it a try.

};
let result = [];

function getValues(element, res = []) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice default in the parens.

return res;
}

for (let i = 0; i < elements.length; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure what's going on with two different loops here. There may be a better way to solve this. Please refer to the video posted about flatten and reduce, it's up in Week 1 on your piazza account.

// `meow` that should return the string `<name> meowed!` where `<name>` is the `name`
// property set on the Cat instance.

class User {
Copy link
Contributor

Choose a reason for hiding this comment

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

This all looks really good. It seems like you have a good grasp on these concepts here.


return (...val) => {
count++;

Copy link
Contributor

Choose a reason for hiding this comment

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

No need for this space right here.

const result = [];
return (unknown) => {
if (arg.indexOf(unknown) !== -1) {
return result[arg.indexOf(unknown)];
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice work. I really like indexOf. And I like that you used an array to cache your function call. I would rename this array to something more descriptive other than 'arg' just to make sure if someone was to re-read your code, they'd be able to understand exactly what 'arg' is.

return result.push(obj[k]);
});

// for (const key in obj) {
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 deleted code that you've commented out. It makes for a cleaner submission.

// Return `obj`.
// http://underscorejs.org/#defaults
function hasKey(o, ky) {
// const objKeys = Object.keys(o);
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove this commented out code

const nFibonacci = (n) => {
// fibonacci sequence: 1 2 3 5 8 13 ...
// return the nth number in the sequence
if (n < 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can simplify all of this logic to one single line. if (n <= 2) return n

});
// console.log(`Check: No object found in values. (@ depth level:${level})`);
return true;
// ~~~~~~~~WHYYY!!!!!! Does this happen!!!!!!~~~~~
Copy link
Contributor

Choose a reason for hiding this comment

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

You're going to be receiving this as a toy problem today. You should be able to think through it. Otherwise you'll have some exposure to it and you'll be able to come back and nail it!

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.