-
Notifications
You must be signed in to change notification settings - Fork 7
Alaa_Nasher-w3-JavaScript #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Alaa_Nasher-w3-JavaScript #11
Conversation
dardecena
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super great job! I added some minor comments on how to improve your code maintenance. Overall a solid effort.
| const evenMumbers = numbers | ||
| .filter((num) => num % 2 === 0) | ||
| .map((num) => num * 2); | ||
|
|
||
| // const newNumbers = []; | ||
| // for (let i = 0; i < numbers.length; i++) { | ||
| // if (numbers[i] % 2 === 0) { | ||
| // newNumbers.push(numbers[i] * 2); | ||
| // } | ||
| // } | ||
| return evenMumbers; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job!
Some minor suggestions:
- Remove code that is not being used. Be kind to your future self and clean up unused code so it doesn't bulk up the codebase 😉
- There's a spelling error for the constant "evenNumbers"
Overall a great effort. Good understanding of how to use array methods filter() and map().
| const { duration } = require('moment/moment'); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this is being used in the required task. If not, please delete it.
| return `€${hourlyRate.toFixed(2)}`; | ||
| } | ||
|
|
||
| //console.log(computeEarnings(mondayTasks, hourlyRate)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great for testing, but when no longer needed, it is a great practice to remove it from the codebase.
| function computeEarnings(tasks, rate /* TODO parameter(s) go here */) { | ||
| // TODO complete this function | ||
| const hourlyRate = tasks | ||
| .map((task) => (task.duration / 60) * rate) | ||
| .reduce((sum, num) => sum + num); | ||
| return `€${hourlyRate.toFixed(2)}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic! Shows good understanding of using map() and reduce methods and string templating.
| function sanitizeFruitBasket(fruit, name) { | ||
| // TODO complete this function | ||
| return fruit.filter((ele) => ele !== name); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job using the filter method.
| c: 'amount, this, wallet' | ||
| }, | ||
| answer: '?', | ||
| answer: 'b', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| c: 'transferInto, anonymous' | ||
| }, | ||
| answer: '?', | ||
| answer: 'c', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:+1
| c: 'Step' | ||
| }, | ||
| answer: '?', | ||
| answer: 'a', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| c: 'Transferring € 50,00 from Jack to Jane' | ||
| }, | ||
| answer: '?', | ||
| answer: 'a', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| c: 'Jane' | ||
| }, | ||
| answer: '?', | ||
| answer: 'c', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
No description provided.