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

I using trying to object property shorthand with object literals to create and return an object with name , age and gender properties.

Your code so far


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

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36.

Challenge: Write Concise Object Literal Declarations Using Object Property Shorthand

Link to the challenge:

look at the example
this doesn’t use shorthand

{
  x: x,
  y: y
}

this does use shorthand

{x, y}

you are still using the key: value syntax which is not used for shorthand

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.