Skip to content

Frank Benevento - Javascript II#381

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

Frank Benevento - Javascript II#381
BeneventoFrank wants to merge 1 commit into
bloominstituteoftechnology:masterfrom
BeneventoFrank:master

Conversation

@BeneventoFrank

Copy link
Copy Markdown

No description provided.

// ==== Challenge 4: Use .reduce() ====
// The donations need to be tallied up and reported for tax purposes. Add up all the donations into a ticketPriceTotal array and log the result
let ticketPriceTotal = [];
ticketPriceTotal = runners.reduce((acc,value) =>{return acc +value.donation},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.

well done on all of these

{ return accumulator = accumulator}
},'')

console.log(longestEmail)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I love this, well done!

Comment thread assignments/callbacks.js


function getLength(arr, cb) {
return(cb(arr.length));

@Wdifulvio523 Wdifulvio523 Sep 12, 2018

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

you would actually pass the entire array into the call back here, like this:
function getLength(arr, cb) {
console.log(cb(arr));
}

Comment thread assignments/callbacks.js
multiplyNums(2,3,function(element){console.log(element)})

function contains(item, list, cb) {
cb(list.includes(item))

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 on this!

Comment thread assignments/closure.js
};
let newCounter = counter();
console.log(newCounter());
console.log(newCounter());

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 counter

let myFunction = ()=>{};
// let myFunction = function () {};

let anotherFunction = param => {return param};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

with arrow syntax, if it's all on the same line, you don't need to say return


// exampleArray = [1,2,3,4];
let exampleArray = [1,2,3,4];
const triple = exampleArray.map(num => {return num * 3})

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 on all of these!

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