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

Solution #2288

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Solution #2288

wants to merge 3 commits into from

Conversation

valet2102
Copy link

No description provided.

Copy link

@roman-mirzoian roman-mirzoian left a comment

Choose a reason for hiding this comment

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

A job well done, but needs some finishing touches.

src/makeRobot.js Outdated
@@ -39,6 +39,67 @@
*/
function makeRobot(name, wheels, version) {
// write code here
const obj = {

Choose a reason for hiding this comment

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

The obj is not a descriptive variable name. It is recommended to use meaningful variable names. For example, you could use robot instead.

src/makeRobot.js Outdated

};

obj.name = name;

Choose a reason for hiding this comment

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

If we do not change these fields ( name, version, and wheels) while working with the makeRobot function, it is better to define them at the beginning, during the creation of the object.

src/makeRobot.js Outdated
+ ', chip version: '
+ this.version
+ ', wheels: '
+ this.wheels;

Choose a reason for hiding this comment

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

You can return the string here just like you do in the getter location().

this.coords.y -= value;
}

return this;

Choose a reason for hiding this comment

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

It is not necessary to return this every time, if we do some operation on the data and we do not need this as a result of execution.

Copy link
Author

@valet2102 valet2102 Jul 17, 2023

Choose a reason for hiding this comment

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

but without "return this" we can`t use them step by step like this :robot.goBack(1).goForward(17).goForward(-1).goLeft(3).goLeft(7).goRight();

Choose a reason for hiding this comment

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

Yes, you are right 👍

+ ', wheels: '
+ this.wheels;
},
get location() {

Choose a reason for hiding this comment

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

Do not forget about good formatting of the code (in this case, there is no empty line before each new method).

Copy link

@polinavafik polinavafik left a comment

Choose a reason for hiding this comment

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

well done!! 🎀

src/makeRobot.js Outdated
Comment on lines 92 to 93
this.coords.x = 1400;
this.coords.y = 500;
Copy link

Choose a reason for hiding this comment

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

get rid of magic numbers

src/makeRobot.js Outdated
return `${name}: x=${this.coords.x}, y=${this.coords.y}`;
},

goBack(value = 1) {
Copy link

Choose a reason for hiding this comment

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

let's replace value with step

@valet2102 valet2102 requested a review from tiserett August 3, 2023 16:20
Copy link

@Moroz-Dmytro Moroz-Dmytro left a comment

Choose a reason for hiding this comment

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

👍

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

Successfully merging this pull request may close these issues.

5 participants