Shorthand property

Tell us what’s happening:

I have a problem in solving this code

Your code so far
const createPerson = (name, age, gender) =>
“use strict”;
// Only change code below this line
({ name, age, gender });
// Only change code above this line


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


Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36.

Challenge: Write Concise Object Literal Declarations Using Object Property Shorthand

Link to the challenge:

Hello~!

It looks like you’ve removed the opening and closing curly brackets for the function, and are missing a return statement.

thank you for your reply,
but should I have a return statement when I use the arrow operator?

In this case, yes, because the use strict line is part of the function. The rules seem to change a bit when your arrow function is multi-line.

Thank you again for your solution you helped me a lot through my studying.

1 Like