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

soltion #2492

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

Conversation

Patryk-Buczkowski
Copy link

No description provided.

Copy link

@Radoslaw-Czerniawski Radoslaw-Czerniawski left a 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: '

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 = {

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) {

Choose a reason for hiding this comment

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

Currently there is no way of knowing whether user passes a number to this method
image

  • for example string 00023 is greater than number 0
  • I could pass it to this method and overwrite some coordinate into a string

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)) {

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.

3 participants