I encountered an issue with the default code to work on in this specific course topic, which might cause unnecessary confusion to other beginners like me. Here’s the default code:
const createPerson = (name, age, gender) => {
// Only change code below this line
return {
name: name,
age: age,
gender: gender
};
// Only change code above this line
};
The problem I have with this is that the comments say to only change the code within the designated area, but you’ll need to add parentheses outside the curly brackets that define the whole function, which is outside the supposed area of code that is to be only strictly edited.
Here’s the working solution:
const createPerson = (name, age, gender) => ({
// Only change code below this line
name,
age,
gender
// Only change code above this line
});
This is my first post and I don’t know how to make the codes above look like they’re actual codes like I see in the other posts, so please forgive me. I hope this makes sense.