Tell us what’s happening:
In the getMousePosition example, there is no return statement in curly brackets after the arrow.
const getMousePosition = (x, y) => ({ x, y });
The challenge has us use { return { } } after the arrow statement. (as seen in the answer below)
const createPerson = (name, age, gender) => {
"use strict";
// Only change code below this line
return { name, age, gender};
// Only change code above this line
};
My question is: Why is there { return {} } after the => , and not just ({ }) as seen in the getMousePosition example? What is the difference?
Thanks,
Noob.
Your code so far
const createPerson = (name, age, gender) => ({name, age, gender}) ;
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Safari/605.1.15
.
Challenge: Write Concise Object Literal Declarations Using Object Property Shorthand
Link to the challenge: