[Some bug] Write Concise Declarative Functions with ES6

Tell us what’s happening:
The following code is still passing the testing algorithms.

It asks us to use the ES6 shorthand for the object method, but just running the code in the semi-ES5 code still passes.

Not sure if it is just me though.

Your code so far


// change code below this line
const bicycle = {
  gear: 2,
  setGear: function(newGear) {
    "use strict";
    this.gear = newGear;
  }
};
// change code above this line
bicycle.setGear(3);
console.log(bicycle.gear);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/write-concise-declarative-functions-with-es6

Hello Dear,

Thank you so much for another great catch! perfect.

It seems some FCC tests are just tend to check the output, while they would better check the syntax. but please note checking syntax to validate and test something doesn’t make sense in enterprise(real world) since output is the one important.

Going to report it as bug dear, thank you so much again ,really appreciate it.

1 Like
1 Like

following will pass the test:

// change code below this line
const bicycle = {
gear: 2,
setGear(newGear) {
this.gear = newGear;
}
};
// change code above this line
bicycle.setGear(3);
console.log(bicycle.gear);

1 Like