-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
Building a Tiny JS World #31
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! Nice work, let's make it a little better.
}; | ||
|
||
|
||
const inhabitants = [dog, cat, woman, man,]; |
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.
There is no reason to leave a trailing coma if a whole array is on the same line.
legs: 2, | ||
hands: 2, | ||
saying: 'bye', | ||
}; |
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 going to write this once, but you have to fix indentations in the whole file.
return keys.map(key => el[key]); | ||
}); | ||
|
||
description.map(el => print(el.join('; '))); |
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.
Add an empty line in the end of the file.
|
||
const keys = ['species', 'name', 'gender', 'legs', 'hands', 'saying']; | ||
|
||
const description = inhabitants.map((el) => { |
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.
Maybe there could be a better name for an inhabitant than el
. el
and key
are a little too generic.
Indentations are still wrong. You should close |
я видимо неправильно понял предыдущее замечание по запятым) спасибо! исправил. А если объект записать в одну строчку, то запятая после последней пары ключ-значение тоже будет лишняя? или это касается только массивов? как здесь например: |
Yes, both objects are writter right. This trailing coma is useful when you need to add something in this list of things. If you don't leave the coma, add something (with a coma of course) and check it in a git diff, you'll see both lines effected, because you added a coma to the existing one. It adds a little confusion. Though, sometimes you should not leave a trailing coma, like, for example, JSON syntax required you to remove trailing comas. You did it right now. |
@maximmorenko we need to fix the following situation: Please submit a PR that will:
|
Building a Tiny JS World
Demo |
Code base