Skip to content

Conversation

@Alaa2019-ml
Copy link

No description provided.

Copy link

@dardecena dardecena left a 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.

Comment on lines +15 to +25
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;

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().

Comment on lines +1 to +2
const { duration } = require('moment/moment');

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));

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.

Comment on lines +35 to +40
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)}`;

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.

Comment on lines +28 to 31
function sanitizeFruitBasket(fruit, name) {
// TODO complete this function
return fruit.filter((ele) => ele !== name);
}

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',

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',

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',

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',

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',

Choose a reason for hiding this comment

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

👍

@dardecena dardecena removed their assignment Sep 16, 2025
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