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

added a-tiny-js-world #364

Merged
merged 3 commits into from
Oct 1, 2022
Merged

added a-tiny-js-world #364

merged 3 commits into from
Oct 1, 2022

Conversation

loki13btz
Copy link
Contributor

@loki13btz loki13btz commented Aug 30, 2022

tiny-js-world

Demo |
Code base

The code is submitted in a dedicated feature branch.

Only code files are submitted.

Please, review.

@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 listed/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. 😒

A Tiny JS World -- (pre-OOP) exercise check list

Relates to Object-Oriented JavaScript task.

Check-list - definition of done

  • Code is DRY, which means that whenever you see a pattern in your code those should be eliminated as much as possible. Examples:
    • print(dog); print(cat); etc ... should be refactored employing Array.forEach as the least
    • `${obj.legs}; ${obj.name}; etc...` (yes, strings are also code) must be refactored employing appropriate Array methods
  • Object methods like keys, values, entries shouldn't be used when a particular order is required as these do not guarantee any particular order of keys/values. Same refers to for...of and for...in when applied to objects.
    Hint: List explicitly the properties used to form an object presentation string.
  • Men and women belong to the same biological species.
  • ES6 class or prototype-based OO syntax aren't used.

Universal recommendations:

  • Give variables and functions meaningful names. Avoid generic names like item, element, key, object, array or their variations. Exception: helper functions that are specifically and intentionally designed to be multipurpose.
  • Function names should start with a verb as they denote actions; variables are normally nouns; boolean variables/functions start with is, does, has etc; variable containing multiple entities and functions returning lists contain entity name in plural form.
  • Have consistent code style and formatting. Employ Prettier to do all dirty work for you.
  • Use common sense or seek for an advice whenever requirements look ambiguous or unclear.

Also take a note of the requirements above and follow them in all your future projects.

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

Sincerely yours,
Submissions Kottachecker 😺

Copy link

@yaripey yaripey left a comment

Choose a reason for hiding this comment

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

Hey, let's make some changes to your code. First of all, your demo doesn't work, fix it, please.
Secondly, check the comments below.

species: "human",
name: "Tom",
gender: "male",
legs: 4,
Copy link

Choose a reason for hiding this comment

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

4-legged humans? Something new.

gender: "female",
legs: 4,
hands: 0,
saying: cat.saying,
Copy link

Choose a reason for hiding this comment

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

What if you change what the cat is saying?

saying: "Have a good day!",
};
const catWoman = {
species: "hulf-human",
Copy link

Choose a reason for hiding this comment

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

half

const arr = [dog, cat, man, woman, catWoman];
// ... other objects ...
arr.forEach((element) => {
print(Object.values(element).join(';'));
Copy link

Choose a reason for hiding this comment

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

The task specifically states not to use Object.values and similar methods.

saying: cat.saying,
};
const arr = [dog, cat, man, woman, catWoman];
// ... other objects ...
Copy link

Choose a reason for hiding this comment

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

What other objects?

hands: 0,
saying: cat.saying,
};
const arr = [dog, cat, man, woman, catWoman];
Copy link

Choose a reason for hiding this comment

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

Don't use such broad names, especially don't use data types in variable names. Something like inhabitants should work best. It states what kind of data is in the array and since it's plural it suggests that it is an array.

@loki13btz
Copy link
Contributor Author

@artem-trubin check my changes, please

Copy link

@yaripey yaripey left a comment

Choose a reason for hiding this comment

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

Your demo shows nothing and it has an error in the console. Please fix it before asking for another review.

@loki13btz
Copy link
Contributor Author

@artem-trubin I corrected my mistakes, please check

Copy link

@yaripey yaripey 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!

@yaripey yaripey merged commit 9e3c1eb into kottans:main Oct 1, 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