Skip to content

Abraham Andujo & Kaitlin Schorr#238

Open
foxtara1 wants to merge 6 commits intobloominstituteoftechnology:masterfrom
foxtara1:master
Open

Abraham Andujo & Kaitlin Schorr#238
foxtara1 wants to merge 6 commits intobloominstituteoftechnology:masterfrom
foxtara1:master

Conversation

@foxtara1
Copy link
Copy Markdown

No description provided.

// contains checks if an item is present inside of the given array/list.
// Pass true to the callback if it is, otherwise pass false.
for (let i = 0; i < list.length; i++) {
if (item === list[i]) {
Copy link
Copy Markdown

@frankfaustino frankfaustino Feb 22, 2018

Choose a reason for hiding this comment

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

Instead of the if/else statements here, you could just do cb(item === list[i]), since that expression evaluates to true or false anyway. That will also pass the test.

Alternatively, you could have done const contains = (item, list, cb) => cb(list.includes(item));

// `decrement` should decrement the counter variable and return it.
const Obj = {
count: 0,
increment() { return Obj.count += 1; },
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is really cool! Instead of Obj.count, you could instead this.count and not have to assign the entire object to the variable Obj and returned it instead.

return null;
}
limit++;
return cb(...args);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice work! 👌

// `cb` should only ever be invoked once for a given set of arguments.
const obj = {};

return (arg) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Well done! 🙌

const value = Object.values(obj);
const result = {};
for (let i = 0; i < key.length; i++) {
result[obj[key[i]]] = value[i];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should be result[value[i]] = key[i];

@frankfaustino
Copy link
Copy Markdown

Excellent work! 🤘 Just some minor corrections. I recommend solving flatten and internalizing it, since that will be on your Sprint Challenge tomorrow!

  • Most tests are passing (besides a couple of from objects.js)
  • Code is consistent with JS idioms and style ✔️
  • Good grasp of the sprint material ✔️

Please close this pull request after reviewing feedback. Thanks! Keep up the good work.

@frankfaustino
Copy link
Copy Markdown

Also, feel free to DM me if you'd like me to go over mapObject, defaults from objects.js or flatten

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.

3 participants