-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
soltion #2492
base: master
Are you sure you want to change the base?
soltion #2492
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there :D, left some comments
src/makeRobot.js
Outdated
}, | ||
|
||
get info() { | ||
return 'name: ' + this.name + ', chip version: ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally prefer string interpolation over concatenation
return `name: ${this.name}, chip version: ${this.version}, wheels: ${this.wheels}`;
src/makeRobot.js
Outdated
@@ -38,7 +38,65 @@ | |||
* @return {Robot} | |||
*/ | |||
function makeRobot(name, wheels, version) { | |||
// write code here | |||
const robot = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to declare a variable, just return this object here
return {
name,
version,
...
src/makeRobot.js
Outdated
}, | ||
|
||
goForward(move = 1) { | ||
if (move > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be best to declare some method on this robot that object will help with evaluating whether your move is a number and whether it's greater than 0, it could be used in the if condition like so
if (this.isPositiveNumber(move)) {
No description provided.