-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
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.
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); |
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.
👍
console.log("The number " + i.toString() + " is odd") | ||
} | ||
|
||
}; |
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.
👍 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? |
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.
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) | ||
}; | ||
} |
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.
👍 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]) | ||
} | ||
} |
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.
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? 🙂
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.
That's smarter, thanks :)
} else if (100>=grade>=90) { | ||
console.log('You got an A' + ' (' + grade + '%' + ')'); |
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 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.
No description provided.