question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect commenting for "Write Concise Object Literal Declarations Using Object Property Shorthand" challenge.

See original GitHub issue

Affected page

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/es6/write-concise-object-literal-declarations-using-object-property-shorthand

Your code

const createPerson = (name, age, gender) => ({
  // Only change code below this line
    name,
    age,
    gender
  });
  // Only change code above this line

Expected behavior

const createPerson = (name, age, gender) => {
  return {
    name: name,
    age: age,
    gender: gender
  };
};

This solution requires the first and second lines to be edited, however, the comments ask not to do this.

The comments should accurately reflect the solution, or not exist at all.

Screenshots

System

  • Device: Laptop
  • OS: macOS Big Sur
  • Browser: Edge
  • Version: 98.0.1108.56

Additional context

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ShaunSHamiltoncommented, Mar 9, 2022

And given that it skips over the fact that a function implicitly returning an object needs to wrap the object in ()

This is covered in an earlier lesson: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/es6/use-arrow-functions-to-write-concise-anonymous-functions

So, I suggest not adding any note about implicitly returned objects.


Personally, I see no problem with this challenge, because it has given you the information you need, and has given you the specifications you need to follow in order to pass.

Specifically, part of the challenge is to accomplish the “task” only within the marked region. If a Camper is struggling to think of how to do this, then they are encouraged to open a topic on the forum.

0reactions
jeremyltcommented, Mar 18, 2022

I’d be fine with that, personally

Read more comments on GitHub >

github_iconTop Results From Across the Web

freeCodeCamp Challenge Guide: Write Concise Object Literal ...
Here, we are tasked at returning an object that accepts the function's parameters as its attributes. Hints. Hint 1. Get rid of the...
Read more >
ES6 - Write Concise Object Literal Declarations ... - YouTube
In this JavaScript ES6 tutorial we write concise object literal declarations using object property shorthand.
Read more >
Write Concise Object Literal Declarations Using ... - YouTube
Certification: JavaScript Algorithms and Data Structures Course: ES6 Lesson: Write Concise Object Literal Declarations Using Object Property ...
Read more >
Learn ES6 (18/31) | Write Concise Object Literal Declarations ...
Learn ES6 (18/31) | Write Concise Object Literal Declarations Using Object Property Shorthand | freeCodeCamp.
Read more >
How to use Object Property Shorthand in JavaScript (ES6)
By watching this video, you will learn how to write concise object literal declarations in JavaScript by using object property shorthand.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found