Skip to content
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

A Tiny JS World #71

Merged
merged 4 commits into from
Aug 6, 2022
Merged

A Tiny JS World #71

merged 4 commits into from
Aug 6, 2022

Conversation

OlStani
Copy link
Contributor

@OlStani OlStani commented Aug 5, 2022

###A Tiny JS World

Demo |
Code base

The code is submitted in a dedicated feature branch.

Only code files are submitted.

Please, review.

@OlStani OlStani changed the title Second A Tiny JS World Aug 5, 2022
Copy link
Member

@OleksiyRudenko OleksiyRudenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!
A couple of fixes and we are done.

}

const inhabitants = [cat, dog, woman, man]
const inhabitantsInformation = inhabitants.map(({name, gender, legs, hands,saying}) => [`${name}; ${gender}; ${legs}; ${hands}; ${saying}`])
Copy link
Member

@OleksiyRudenko OleksiyRudenko Aug 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having props explicitly listed ({name, gender, legs, hands,saying}) is a good approach.
Please use #Array.map and #Array.join to build the presentation string in the callback function. Remember, you can pack arguments into an array, e.g. ({a1, a2}) => [a1, a2]......some array processing code....

Also why do you need to wrap every presentation string into an array? You have nested arrays as a result.

On your demo page, open dev console and type inhabitantsInformation to see the data structure.

Feel free seeking help in students' chat.

Copy link
Contributor Author

@OlStani OlStani Aug 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use #Array.map and #Array.join to build the presentation string in the callback function. Remember, you can pack arguments into an array, e.g. ({a1, a2}) => [a1, a2]......some array processing code....

я не зовсім розумію що я маю тут зробити : Please use #Array.map and #Array.join to build the presentation string in the callback function. Remember, you can pack arguments into an array, e.g. ({a1, a2}) => [a1, a2]......some array processing code....
як будете мати час напишіть будь-ласка https://t.me/olstaniev

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's start with answering questions.

Also why do you need to wrap every presentation string into an array? You have nested arrays as a result.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's start with answering questions.

Also why do you need to wrap every presentation string into an array? You have nested arrays as a result.

я вже виправив це

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

метод map повертає мені массив строк

Copy link
Member

@OleksiyRudenko OleksiyRudenko Aug 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

я вже виправив це

I can only see what's on PR.

image

Copy link
Member

@OleksiyRudenko OleksiyRudenko Aug 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

метод map повертає мені массив строк

That's how it works. You can glue them with e.g. .join

Copy link
Member

@OleksiyRudenko OleksiyRudenko Aug 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a peer developer on this project, and was asked to add 100 more objects with yet another 20 properties.
Please make my life easier.

@OlStani OlStani requested a review from OleksiyRudenko August 6, 2022 17:07
Copy link
Member

@OleksiyRudenko OleksiyRudenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make properties separated exactly with '; '

@OlStani OlStani requested a review from OleksiyRudenko August 6, 2022 17:14
Copy link
Member

@OleksiyRudenko OleksiyRudenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OlStani this works, grats.

I guess your latest change was inspired by other soultions. However, your own initial approach might have been improved with a minor change reducing code repetition. E.g.

const inhabitantsInformation = inhabitants.map(({name, gender, legs, hands,saying}) => [name, gender, legs, hands, saying].join('; '))

@OleksiyRudenko OleksiyRudenko merged commit 4768dcd into kottans:main Aug 6, 2022
@OlStani
Copy link
Contributor Author

OlStani commented Aug 6, 2022

то було занадто просто, тому не прийшло мені в глову)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants