--- id: 587d7b8a367417b2b2512b4f title: Write Concise Object Literal Declarations Using Simple Fields localeTitle: Escriba declaraciones literales de objetos concisos utilizando campos simples challengeType: 1 --- ## Description
ES6 agrega un buen soporte para definir fácilmente literales de objetos. Considera el siguiente código:
const getMousePosition = (x, y) => ({
  x: x,
  y: y
});
getMousePosition es una función simple que devuelve un objeto que contiene dos campos. ES6 proporciona el azúcar sintáctico para eliminar la redundancia de tener que escribir x: x . Simplemente puede escribir x una vez, y se convertirá a x: x (o algo equivalente) debajo del capó. Aquí se reescribe la misma función de la anterior para usar esta nueva sintaxis:
const getMousePosition = (x, y) => ({ x, y });
## Instructions
Utilice campos simples con objetos literales para crear y devolver un objeto Person .
## Tests
```yml tests: - text: 'la salida es {name: "Zodiac Hasbro", age: 56, gender: "male"} .' testString: 'assert(() => {const res={name:"Zodiac Hasbro",age:56,gender:"male"}; const person=createPerson("Zodiac Hasbro", 56, "male"); return Object.keys(person).every(k => person[k] === res[k]);}, "the output is {name: "Zodiac Hasbro", age: 56, gender: "male"}.");' - text: 'No : fueron utilizados'. testString: 'getUserInput => assert(!getUserInput("index").match(/:/g), "No : were used.");' ```
## Challenge Seed
```js const createPerson = (name, age, gender) => { "use strict"; // change code below this line return { name: name, age: age, gender: gender }; // change code above this line }; console.log(createPerson("Zodiac Hasbro", 56, "male")); // returns a proper object ```
## Solution
```js // solution required ```