London10 - Eagles - Kristina Dudnyk - JavaScript-2 - Week-1#245
London10 - Eagles - Kristina Dudnyk - JavaScript-2 - Week-1#245KristinaDudnyk wants to merge 2 commits intoCodeYourFuture:mainfrom
Conversation
| capitalCities.Peru.name = "Lima"; | ||
| capitalCities.Peru.population = 9750000; | ||
| console.log(capitalCities); | ||
|
|
There was a problem hiding this comment.
instead of adding an empty variable and then adding values to it you can add the new country and its properties in one statement
capitalCities.peru = { name: "Lima", population: 9750000 };
|
|
||
| // write code here | ||
| if(student.examScore > 60 && student.attendence >= 90){ | ||
| student.hasPassed = true |
There was a problem hiding this comment.
here bracket notation is meant to be used instead of the . notation
2-mandatory/1-recipes.js
Outdated
| console.log(TheRecipeCard.title) | ||
| console.log(`Serves: ${TheRecipeCard.Serves}`) | ||
| console.log(TheRecipeCard.Ingredients.forEach(property => {console.log(property)})) | ||
| //why do I have underfind for 5th element wich doesn't exist ? :< No newline at end of file |
There was a problem hiding this comment.
The reason you're getting undefined is that the forEach method doesn't return a value. It simply iterates over each element of the array and performs an operation on it, but it doesn't return anything. for example: TheRecipeCard.Ingredients.forEach(property => { console.log(property);
|
|
||
| function createLookup(countryCurrencyCodes) { | ||
| // write code here | ||
| return Object.fromEntries(countryCurrencyCodes); |
There was a problem hiding this comment.
Here you're not quite looking up for each country and currency
|
|
||
| let cashRegister = { | ||
| // write code here | ||
| orderBurger (balance){ |
There was a problem hiding this comment.
here the balance is actually the remaining balance so at some point we would not have any remaining balance left
| function countWords(string) { | ||
| const wordCount = {}; | ||
| const words = string.split(" ") | ||
|
|
There was a problem hiding this comment.
this looks really good but you could also check if the string is empty before beginning?
There was a problem hiding this comment.
you're also only splitting using spaces, what if there was a comma or any other punctuation in the string would it still work?
mira-shukla
left a comment
There was a problem hiding this comment.
really great work overall just some small improvements :)
Volunteers: Are you marking this coursework? You can find a guide on how to mark this coursework in
HOW_TO_MARK.mdin the root of this repositoryYour Details
Homework Details
Notes
What did you find easy?
What did you find hard?
What do you still not understand?
Any other notes?