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

add task solution #2530

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

Conversation

netzelnatalia
Copy link

No description provided.

Copy link

@nazarmatsevych nazarmatsevych left a comment

Choose a reason for hiding this comment

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

Almost done, let's make a little improvements

src/makeRobot.js Outdated
Comment on lines 64 to 71
goBack(steps = 1) {
if (steps > 0) {
this.coords.y -= steps;
}

return this;
},
goRight(steps = 1) {

Choose a reason for hiding this comment

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

Suggested change
goBack(steps = 1) {
if (steps > 0) {
this.coords.y -= steps;
}
return this;
},
goRight(steps = 1) {
goBack(steps = 1) {
if (steps > 0) {
this.coords.y -= steps;
}
return this;
},
goRight(steps = 1) {

Add empty line between methods

src/makeRobot.js Outdated
},
get info() {
const robotName = `name: ${this.name}, `;
const robotInfo = `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.

Or you can use concatenation instead

src/makeRobot.js Outdated
this.coords.x = 1400;
this.coords.y = 500;

return this;

Choose a reason for hiding this comment

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

You are not going to call this method in the chain, so no need to return this here

Copy link

@nazarmatsevych nazarmatsevych left a comment

Choose a reason for hiding this comment

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

👍

Comment on lines +49 to +63
get info() {
return 'name: ' + this.name + ', chip version: '
+ this.version + ', wheels: ' + this.wheels;
},
get location() {
return this.name + ': x=' + this.coords.x + ', y=' + this.coords.y;
},
goForward(steps = 1) {
if (steps > 0) {
this.coords.y += steps;
}

return this;
},
goBack(steps = 1) {

Choose a reason for hiding this comment

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

Suggested change
get info() {
return 'name: ' + this.name + ', chip version: '
+ this.version + ', wheels: ' + this.wheels;
},
get location() {
return this.name + ': x=' + this.coords.x + ', y=' + this.coords.y;
},
goForward(steps = 1) {
if (steps > 0) {
this.coords.y += steps;
}
return this;
},
goBack(steps = 1) {
get info() {
return 'name: ' + this.name + ', chip version: '
+ this.version + ', wheels: ' + this.wheels;
},
get location() {
return this.name + ': x=' + this.coords.x + ', y=' + this.coords.y;
},
goForward(steps = 1) {
if (steps > 0) {
this.coords.y += steps;
}
return this;
},
goBack(steps = 1) {

Add empty line between all your methods

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.

2 participants