-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
NW-6 | Zeliha Pala | JS2 | [TECH ED] exercises | WEEK-2 #153
base: main
Are you sure you want to change the base?
NW-6 | Zeliha Pala | JS2 | [TECH ED] exercises | WEEK-2 #153
Conversation
✅ Deploy Preview for cute-gaufre-e4b4e5 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
not finished yet |
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.
@zelihapala , this is really awesome work!
I'm impressed with every your explanation and implementation. And especially 🥇 for stretch block.
Though, it seems to me that Interpret block is missing from this week module. If so would you please add it? I'm sure it won't take much time for you!
console.log(`My house number is ${address.houseNumber}`); | ||
//or | ||
console.log(`My house number is ${address[`houseNumber`]}`); |
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'm sure this solution would be enough 👍
// To access the values within an object, we can use various methods like Object.values(), Object.keys(), or Object.entries(). | ||
|
||
for (const value of Object.values(author)) { | ||
console.log(value); | ||
} | ||
|
||
// or | ||
for (const key of Object.keys(author)) { | ||
console.log(author[key]); | ||
} | ||
|
||
// or | ||
for (const [key, value] of Object.entries(author)) { |
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.
Awesome knowledge of Object methods and iteration approaches!
for (let i = 0; i < listOfItems.length; i++) { | ||
let eachItem = listOfItems[i]; |
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's absolutely correct and works perfect! But just a question: do you really need a for
loop here? Do you really need the indexes? Can you achieve the same result with for ... of
loop?
for (const word of words) { | ||
if (wordCount[word]) { | ||
wordCount[word]++; | ||
} else { | ||
wordCount[word] = 1; | ||
} | ||
} |
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.
Ah, here you go, using for ... of
loop. Great!
|
||
for (const [coin, quantity] of Object.entries(till)) { | ||
console.log(coin * quantity); | ||
total += coin * quantity; | ||
const numericValue = parseFloat(coin.replace(/[^\d.]/g, "")); |
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 we can even parseFloat
without replacing non numeric characters 🤔
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.