Abraham Andujo & Kaitlin Schorr#238
Abraham Andujo & Kaitlin Schorr#238foxtara1 wants to merge 6 commits intobloominstituteoftechnology:masterfrom
Conversation
| // 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]) { |
There was a problem hiding this comment.
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; }, |
There was a problem hiding this comment.
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); |
| // `cb` should only ever be invoked once for a given set of arguments. | ||
| const obj = {}; | ||
|
|
||
| return (arg) => { |
| const value = Object.values(obj); | ||
| const result = {}; | ||
| for (let i = 0; i < key.length; i++) { | ||
| result[obj[key[i]]] = value[i]; |
There was a problem hiding this comment.
Should be result[value[i]] = key[i];
|
Excellent work! 🤘 Just some minor corrections. I recommend solving
Please close this pull request after reviewing feedback. Thanks! Keep up the good work. |
|
Also, feel free to DM me if you'd like me to go over |
No description provided.