Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

add reduce map filter#72

Closed
WardMad wants to merge 1 commit intoHackYourFuture:masterfrom
WardMad:master
Closed

add reduce map filter#72
WardMad wants to merge 1 commit intoHackYourFuture:masterfrom
WardMad:master

Conversation

@WardMad
Copy link
Copy Markdown

@WardMad WardMad commented Jul 29, 2018

No description provided.

Copy link
Copy Markdown

@harditsingh harditsingh left a comment

Choose a reason for hiding this comment

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

You did a good job, the code works well and is well formatted. I have some comments though, please see below. Best of luck!


const tasks = monday.concat(tuesday);
const tasks = monday.concat(tuesday)
let minutesToHours = tasks.filter(a => a.duration >= 120).map(h => h.duration / 60);
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 mixed up the order of first 2 steps here. While that does not matter much in this case, you should read the instructions carefully.

// Add your code here
console.log(minutesToHours);

let perHour = minutesToHours.map(v => v * 23) // per hour 23 euro
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 should always have meaningful names for the variables, 'v' is not an intuitive name.


console.log(perHour);

let total = perHour.reduce(function(a, b) {
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 should have used '=>' function here instead of 'function()', that's what the assignment mentioned.


// Add your code here

const newNumbers = numbers.filter(w => w % 2 !== 0).map(x => x * 2);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Another example of non-intuitive naming :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants