For this exercise, if you follow the instruction of “Only change code below/above this line”, your code won’t work. You have to change the first and last curly braces to parentheses to succeed.
The execise:
Use object property shorthand with object literals to create and return an object with name
, age
and gender
properties.
const createPerson = (name, age, gender) => {
// Only change code below this line
return {
name: name,
age: age,
gender: gender
};
// Only change code above this line
};
My solution:
const createPerson = (name, age, gender) => (
// Only change code below this line
{name, age, gender}
// Only change code above this line
);