ES6 provides the syntactic sugar to eliminate the redundancy of having to write x: x. You can simply write x once, and it will be converted tox: x (or something equivalent) under the hood.
So it’s telling you to simplify the way you write the object. If the variable name matches the object key, i.e. x: x or name: name for example, you can just write it once, x or name etc.
In your example the expected return is a little wrong, but understandably so.
ES6 Javascript knows that in that pattern name, age, and gender actually stands for both the key and the value - and that those are two different things!
You are expecting it to recognise them solely as variables, which is sensible, so setting the age variable to 56 means it should read as 56: 56.
But JS cleverly recognises that it represents both the name of the key, age and the variable value that you pass it in the function parameter, 56.
It’s pretty wild, but allows you to write less code to do the same job. This is always a dangerous tradeoff because the terse nature of the new syntax can be harder to read when you are unfamiliar with it, but once you internalise it: less code = fewer potential bugs.
Now I know that in this scenario, ES6 automatically distinguish the key from the parameter, and I should accept this as a common feature in order to save time and avoid bugs. Thank you!