const getMousePosition = (x, y) => ({
x: x,
y: y
});
getMousePosition é uma função simples que retorna um objeto contendo dois campos. ES6 fornece o açúcar sintático para eliminar a redundância de ter que escrever x: x . Você pode simplesmente escrever x uma vez, e ele será convertido em x: x (ou algo equivalente) sob o capô. Aqui está a mesma função acima reescrita para usar esta nova sintaxe: const getMousePosition = (x, y) => ({x, y});
Person . {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: 'Não : foram usados.'
testString: 'getUserInput => assert(!getUserInput("index").match(/:/g), "No : were used.");'
```