Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Week 2 homework Fatih #21

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

Closed
wants to merge 5 commits into from

Conversation

FatihUcars
Copy link

No description provided.

Copy link
Collaborator

@yash-kapila yash-kapila left a comment

Choose a reason for hiding this comment

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

Hi @FatihUcars - I have reviewed your homework and am approving the same. However, I do have some comments and would be nice if you had a look into them. I think it will be helpful. Good luck for JS2. 🙂

let myString = 'hello,this,is,a,difficult,to,read,sentence';
console.log(myString.length);
myString = myString.replace(/,/g," ");
console.log(myString);
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

console.log("The number " + i.toString() + " is odd")
}

};
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 for logic but some unnecessary new lines here which can be avoided for better code styling purposes 🙂

But don't worry, you will learn about it in the future modules.

for (let [key, value] of Object.entries(mealRecipe)) {
console.log(`${key}: ${value}`);
}
// I wanted to make something like: console.log(Object.keys(mealRecipe)[i] + ': ' + mealRecipe[i]); However Icouldn't find a way to loop through Object values. After long reasearch, I found another way in MDN and adapted it. I hope this is not cheating?
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is definitely not cheating. Don't worry. It is encouraged that you find new ways of doing things and fact that you referred MDN for finding about Object.values is quite nice. Good work. However, I would use const instead of let here. 🙂

} else {
console.log('You still need to read ' + books[i].Title)
};
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 for logic but const instead of let here please. Also, some indentation problems with new lines in between the object definition which shouldn't be there.

} else {
drinkTray.push(drinkTypes[i-3])
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Aahaan. You can also make this logic a bit easier by replacing the if-else-if-else block with a single statement drinkTray.push(drinkTypes[i % drinkTypes.length]);. What do you think? 🙂

Copy link
Author

Choose a reason for hiding this comment

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

That's smarter, thanks :)

Comment on lines 7 to 8
} else if (100>=grade>=90) {
console.log('You got an A' + ' (' + grade + '%' + ')');
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it is better to separate this logic using an && condition as it is more explicit and easier to understand. 🙂

Otherwise, I think your logic is correct. But there are still some minor spacing/indentation issues which will be covered in future modules.

@yash-kapila yash-kapila self-assigned this Oct 6, 2019
@nudge nudge closed this Nov 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants