Concise Object Literal Declarations Using Simple Fields

Tell us what’s happening:
To prepare a solution that matches the lesson, it appears we must modify the code outside of the bounds of the instructions to change code only on certain lines.

But, following the lesson code EXACTLY returns an error saying
“No : were used.”

Is this another bug in the E6 curiculum?

Your code so far

/*  Commenting out all of the original challenge code
const createPerson = (name, age, gender) => {
  "use strict";
  // change code below this line
  return {
    name: name,
    age: age,
    gender: gender
  };
  // change code above this line
};
*/

/*This code matches the lesson code exactly*/
/*Lesson code:  const getMousePosition = (x, y) => ({ x, y }); */
const createPerson = (name, age, gender) => ({ name, age, gender });
console.log(createPerson("Zodiac Hasbro", 56, "male")); // returns a proper object

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0) 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-object-literal-declarations-using-simple-fields

actually there is no bug here from my recent experience with the challenge. You just need to change the given code to satisfy the requirement. Let us know if you need further help (but I believe others have asked for help on this before in the forum, so try searching to see if that gets you further).

hint: the answer is a very simple, intuitive line of code.

Hi hbar1st,
Thank you.
I found the problem.
Previously I just commented out the lines showing the : in the section of code that needed to be changed.
The challenge error checker saw the colons even though they were blocked from executing by comment markers.

When I deleted the lines entirely, the error went away.

I do considerthis a bug in the curiculum though.
The challenge error checker should ignore lines that are commented.

Also, the challenge was misleading because there is no place for the “use strict” statement in the correct solution and the “use strict” statement is outside of the bounds of the “// change code below this line.”

I was worried because I thought I would never get a certification with all the bugs that prevent completion of some of the E6 challenges.

But I read in the general forum that now the only challenges that really count are the 5 challenges for each certification.

So, I shall continue to pay my monthly contribution.

Thank you for your help.

Bobby

I don’t want to address the full sum of your comments because my interest is mainly helping you with the code.
For the code part of the comment, I just want you to know, that my solution for this challenge fits into the return statement originally given and without changing anything else (no other lines including the strict line was touched in order to pass the challenge).

So though your method is very concise (and also correct), there is a more ‘verbose’ way of doing the same thing while fitting into the challenge restrictions.

Just fyi. Knowing this should not affect you at all, because you seem to understand the concept being taught.

Ok, thanks for the information about fitting inside the lines.

And thank you for long days and nights answering questions for everyone.

Many thanks.

1 Like