-
-
Notifications
You must be signed in to change notification settings - Fork 184
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
Tiny-world #194
Tiny-world #194
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.
@MarharytaBoichenko well done!
A couple of improvements and we are done.
]; | ||
|
||
inhabitants.forEach((item) => { | ||
console.log(item); |
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.
Please remove debugging statements from code here and before submitting other tasks.
species: "man", | ||
gender: "male", | ||
hands: 2, | ||
legs: 2, | ||
saying: "hello", | ||
friends: ["Bob", "Ann", "Nick"], | ||
}; | ||
const woman = { | ||
name: "Ann", | ||
species: "woman", |
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.
Men and women belong to the same species.
const allInfoInItem = allProperties.map((prop) => | ||
item[prop] ? item[prop] : `no ${prop}` | ||
); |
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.
You don't really want to spend resource on creation of locally scoped method at every loop iteration. Think of 100k iterations.
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.
@MarharytaBoichenko awesome job!
inhabitants.forEach((item) => { | ||
print( | ||
allProperties | ||
.map((prop) => (item[prop] ? item[prop] : `no ${prop}`)) |
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.
You don't really need so many parentheses in arrow functions, they do not really help to identify boundaries of code components, especially in one liners.
.map((prop) => (item[prop] ? item[prop] : `no ${prop}`))
.map(prop => item[prop] ? item[prop] : `no ${prop}`)
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.
exactly) thanks
A Tiny JS World
Demo |
Code base
The code is submitted in a dedicated feature branch.
Only code files are submitted.
Please, review.