Please help me with this code!

Tell us what’s happening:
I been learning from freecode camp javascript, and now i’m learning ES6, but there’s a code i can’t understand how works.

this is the code :

const stats = {
  max: 56.78,
  standard_deviation: 4.34,
  median: 34.54,
  mode: 23.87,
  min: -0.75,
  average: 35.85

const half = ({ max, min }) => (max + min) / 2.0;

My question is, what happend if two differents objects has the same name for their properties ?
Sorry about my english, but i’m from chile and i don´t know very well english.

You still have to call the function and pass it the object. The challenge just doesn’t show the function call.

The object passed to the function is what will determine which object is getting its properties destructured.

const user1 = {
  name: 'Jack',
  age: 32,

const user2 = {
  name: 'Jill',
  age: 23,

const getUser = ({ name, age }) => console.log(name, age);

getUser(user1); // Jack 32
getUser(user2); // Jill 23

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

Please use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks are not single quotes.