Skip to content

add task solution#2530

Open
netzelnatalia wants to merge 5 commits into
mate-academy:masterfrom
netzelnatalia:develop
Open

add task solution#2530
netzelnatalia wants to merge 5 commits into
mate-academy:masterfrom
netzelnatalia:develop

Conversation

@netzelnatalia

Copy link
Copy Markdown

No description provided.

@nazarmatsevych nazarmatsevych left a comment

Copy link
Copy Markdown

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

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

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

Copy link
Copy Markdown

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

Comment thread src/makeRobot.js Outdated
},
get info() {
const robotName = `name: ${this.name}, `;
const robotInfo = `chip version: ${this.version}, wheels: ${this.wheels}`;

Copy link
Copy Markdown

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

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

return this;

Copy link
Copy Markdown

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

@nazarmatsevych nazarmatsevych left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread src/makeRobot.js
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) {

Copy link
Copy Markdown

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