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

Homework week2#30

Closed
zmagzoub wants to merge 3 commits intoHackYourFuture:masterfrom
zmagzoub:master
Closed

Homework week2#30
zmagzoub wants to merge 3 commits intoHackYourFuture:masterfrom
zmagzoub:master

Conversation

@zmagzoub
Copy link

No description provided.

Copy link

@silksil silksil left a comment

Choose a reason for hiding this comment

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

Keep up the good work!

const tasks = monday.concat(tuesday);

// Add your code here
const salary = tasks
Copy link

Choose a reason for hiding this comment

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

you could consider making the function more descriptive e.g. calculateSalary

.map((duration) => duration * 23)
.reduce((acc, current) => acc + current);

console.log('Maartje has earned €' + salary.toFixed(2));
Copy link

@silksil silksil Jun 3, 2018

Choose a reason for hiding this comment

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

I personaly would move the .toFixed(2) to the function 'salary'

.map((duration) => duration * 23)
.reduce((acc, current) => acc + current);

console.log('Maartje has earned €' + salary.toFixed(2));
Copy link

Choose a reason for hiding this comment

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

you could consider to pass the tasks and salary as two arguments, something like:

const calculateEarnings = (arrayOfTasks, hourlyWage) =>
arrayOfTasks.map((task) => task.duration / 60)
.filter((hoursAmount) => hoursAmount >= 2)
.map((paidHoursAmount) => paidHoursAmount * hourlyWage)
.reduce((sum, amount) => sum + amount, 0)
.toFixed(2);

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