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

js-pre-oop #627

Merged
merged 1 commit into from
Sep 26, 2022
Merged

js-pre-oop #627

merged 1 commit into from
Sep 26, 2022

Conversation

merowing
Copy link
Contributor

js-pre-oop

Demo |
Code base

This is the tiny JS World.

The code is submitted in a dedicated feature branch.

Only code files are submitted.

Please, review.

@merowing
Copy link
Contributor Author

What I did:

  • used prettier
  • used local live-server for check the code

@github-actions
Copy link

Hey!

Congratulations on your PR! 😎😎😎

Let's do some self-checks to fix most common issues and to make some improvements to the code before reviewers put their hands on the code.

Go through the requirements/most common mistakes linked below and fix the code as appropriate.

If you have any questions to requirements/common mistakes feel free asking them here or in Students' chat.

When you genuinely believe you are done put a comment stating that you have completed self-checks and fixed code accordingly.

Also, be aware, that if you would silently ignore this recommendation, a mentor can think that you are still working on fixes. And your PR will not be reviewed. 😒

Please, make sure that your code follows the requirements based on the most common mistakes as well as basic requirements from the original task.

Universal recommendations:

  • Make sure your code follows General Requirements
  • Use common sense or seek for an advice whenever requirements look ambiguous or unclear.
  • Pay more attention to code style - descriptive variable names, indentations, empty spaces, etc. Code should look good :)

By the way, you may proceed to the next task before this one is reviewed and merged.

Sincerely yours,
Submissions Kottachecker 😺

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.

@merowing well done!
Check comments below for ideas to absorb and use when solving coding problems.

data.catWoman.say = data.cat.say;
data.woman.species = data.man.species;

const sequences = ['species', 'name', 'gender', 'hands', 'legs', 'say', 'friends'];
Copy link
Member

Choose a reason for hiding this comment

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

Devise a better naming. What does the variable actually contain?

Comment on lines +70 to +72
case 'name':
value = `<strong>${creature[creatureProperty]}</strong>`;
break;
Copy link
Member

Choose a reason for hiding this comment

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

switch is an impretaive way to write code.
Consider using a dictionary (object literal) to define modifiers for properties. Then building an output could be as short as .map(propertyName => `<${tags[propertyName]}>${creature[propertyName]}</${tags[propertyName]}>` )
This way the code would be more declarative, i.e. easier to read and modify.

P.S. There are "null" tags that you could benefit from.

Also consider splitting the handling of properties into a chain of transformations.
E.g. "Remove values that are 'empty', convert arrays into strings, format strings".
Having multiple simple operations vs one complex operation adds to readability and maintainability of code.

@OleksiyRudenko OleksiyRudenko merged commit b7d2bd9 into kottans:main Sep 26, 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.

2 participants