Skip to content

Conversation

@dashaaaa21
Copy link

All Week 2 exercises are completed.
Tests passed for ex1–ex3.
ex4–ex7 are ready for manual review by a mentor.

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.

Nice work overall!
Ex 5 needs some improvement.

Comment on lines +20 to +39
export function giveCompliment(name) {

const compliments = [
"nice",
"kind",
"smart",
"funny",
"good",
"cool",
"sweet",
"happy",
"friendly",
"great"
];

const randomCompliment = compliments[Math.floor(Math.random() * compliments.length)];


return `You are ${randomCompliment}, ${name}!`;

Choose a reason for hiding this comment

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

Great job using ES6 template literals 👍

Copy link
Author

Choose a reason for hiding this comment

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

Thank you! I’m enjoying working with ES6 features.

Comment on lines +43 to +44

const myName = 'Daria';

Choose a reason for hiding this comment

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

👍

Comment on lines +18 to +19
export function calculateDogAge(age) {
return `Your doggie is ${age * 7} years old in dog years!`;

Choose a reason for hiding this comment

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

👍

Comment on lines 35 to 36
function selectRandomly(array) {
return array[Math.floor(Math.random() * array.length)];

Choose a reason for hiding this comment

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

Good job completing the function.

A point of improvement here is the function argument name 'array', it's better to use a more descriptive name (eg. 'choice') to avoid confusion with the build-in Array object or data type.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you! I’ve updated the argument name to be more descriptive

Comment on lines +23 to +27
vine: 5.75,
water: 0.73,
juice: 1.26,
croissant: 3.98,
coffe: 2.33

Choose a reason for hiding this comment

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

👍

Comment on lines +30 to +35
function calculateTotalPrice(object) {
let total = 0;
for (let item in object) {
total += object[item];
}
return `Total: €${total.toFixed(2)}`;

Choose a reason for hiding this comment

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

Nice!

Additional challenge: what's another method you can use to add up all the items in the object

Copy link
Author

Choose a reason for hiding this comment

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

Thank you! I’ve also added this approach as a comment in the code
Additional challenge: These lines go through all the keys in the object and add their values to total.
Another way is to use

function calculateTotalPrice(object) { let total = Object.values(object).reduce((sum, val) => sum + val, 0); returnTotal: €${total.toFixed(2)}; }

Choose a reason for hiding this comment

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

Nice work

function test1() {
console.log('\nTest 1: calculateTotalPrice should take one parameter');
// TODO replace this comment with your code
console.assert(calculateTotalPrice.length === 1, "Should take one parameter");

Choose a reason for hiding this comment

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

👍

Comment on lines +47 to +49
const expected = "Total: €14.05";
const actual = calculateTotalPrice(cartForParty);
console.assert(actual === expected, `Expected "${expected}", got "${actual}"`);
Copy link

@dardecena dardecena Sep 3, 2025

Choose a reason for hiding this comment

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

👍

Comment on lines +32 to 37
function filterPrivateData(employees) {
return employees.map(employee => {
const { name, occupation, email } = employee;
return { name, occupation, email };
});
}

Choose a reason for hiding this comment

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

Great job!

Copy link
Author

Choose a reason for hiding this comment

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

I sincerely appreciate your detailed feedback and guidance

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!!!! 🚀
Thanks for making the necessary changes, and taking time to do the extra challenge.

Comment on lines +35 to +36
function selectRandomly(choices) {
return choices[Math.floor(Math.random() * choices.length)];

Choose a reason for hiding this comment

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

👍


export function tellFortune(/* TODO add parameter(s) here */) {
// TODO complete this function
export function tellFortune(kids, partners, places, jobs) {

Choose a reason for hiding this comment

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

👍

Comment on lines +21 to +30
function addToShoppingCart(item) {
if (item !== undefined) {
shoppingCart.push(item);

if (shoppingCart.length > 3) {
shoppingCart.shift();
}
}

return `You bought ${shoppingCart.join(', ')}!`;

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