Skip to content

Brandon Strellis [Javascript 2] - #383

Open
bstrellis wants to merge 1 commit into
bloominstituteoftechnology:masterfrom
bstrellis:master
Open

Brandon Strellis [Javascript 2]#383
bstrellis wants to merge 1 commit into
bloominstituteoftechnology:masterfrom
bstrellis:master

Conversation

@bstrellis

Copy link
Copy Markdown

No description provided.

if (runner.shirt_size === 'L') {
largeShirts.push(runner);
}
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

compare this to the code solution:
let largeShirts = runners.filter((shirts) => {
return shirts.shirt_size === "L";
});
console.log(largeShirts);

notice we don't need an "if" statement in filter

} else {
return sum;
}
}, 0);

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 examples of these methods!

Comment thread assignments/callbacks.js

function multiplyNums(x, y, cb) {
// multiplyNums multiplies two numbers and passes the result to the callback.
return cb(x * y);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

no need for return on this

Comment thread assignments/callbacks.js

function sumNums(x, y, cb) {
// sumNums adds two numbers (x, y) and passes the result to the callback.
return cb(x + y);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

no need for return on this

Comment thread assignments/closure.js
function tickTocker2() {
count += 1;
return count;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

compare to solution code.

const counter = () => {
let count = 0;
return () => (++count);
};

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.

2 participants