I think solution setup needs function call

Including the function call would provide context to the learner that’s really required to make the complete circuit mentally. Without the function call in this example, it is impossible for the learner to know what object is being fed in as an argument. The location of this object in the code example is completely coincidental until the function is called with the correct object as its argument.

I honestly believe this challenge would be improved by including the function call.

Thanks for reading.

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

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

// Only change code below this line
const half = ({max, min}) => (max + min) / 2.0; 
// Only change code above this line
  **Your browser information:**

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

Challenge: Use Destructuring Assignment to Pass an Object as a Function’s Parameters

Link to the challenge:

This is also the point though. A function definition is independent from function calls. It doesn’t matter what object the function is called with as an argument. The appropriate properties are destructured out for any object.

Sorry, not trying to be contrary here for the sake of it. but seems like a note in the task might be appropriate then?

Also seems like if this is intention then shouldn’t the task description say ‘parameter’ rather than ‘argument’ ?

The argument in my understanding is what is passed in, in this case an object. The parameter is part of the definition right?

“Use destructuring assignment within the argument to the function half to send only max and min inside the function.”

This isn’t a request regarding semantics though (though I am curious if there is a difference of opinion there).

It is worth noting that the questions before and after this question don’t seem to attempt to make this point and I do see function calls passing in arguments in other questions.

Parameter and Argument are often used interchangeably for ‘the stuff you use when calling the function’.

No. What is used when the function is called is completely separate from the function definition itself.

I’m really not sure where along the line learners are missing the point that a function call and a function definition are separate.

// This is the function definition
function someFunction({foo, bar}) {
  console.log("Arguments:");
  console.log("foo:", foo);
  console.log("bar:", bar);

  return foo + bar;
}

// Nothing below this point has anything to do with the 
//   function definition

// This is *a* function call
someFunction({foo: 1, bar: ""});

// This is  a different function call
someFunction({foo: 1});

// And another
someFunction({});

The separation between function calls and function definitions is the entire point of making functions.

My understanding of the words argument and parameter aligns with the interpretation of this article, I do think it is valuable to have words to distinguish between these two concepts.

I think the confusion from the learners currently is that the example names the parameter stats when it could’ve named it anything else and still worked.

stats is coincidentally the name of the example object that would theoretically get passed into the function call.

I think the most helpful way to demonstrate the concept would be to either show the function call or rename the parameter.

Just for ease of reference here’s the original setup:

const stats = {

  max: 56.78,
  standard_deviation: 4.34,
  median: 34.54,
  mode: 23.87,
  min: -0.75,
  average: 35.85
};

// Only change code below this line
const half = (stats) => (stats.max + stats.min) / 2.0;
// Only change code above this line

If you read that article, then it should be clear that calling the argument a ‘parameter’ isn’t quite correct.

Trying to insert a wrong term when the fCC curriculum doesn’t really use the word parameter wouldn’t be a good idea.

The two terms are still used interchangeably in many contexts, and I don’t think creating a vocab distinction here is useful.

This is an important point. Learners don’t always understand variable scope, especially for function arguments. I’m not sure that avoiding their misunderstanding helps them in the long-term.

Personally, I agree and I’m pretty sure I have made some of the same observations as you.

I see no good reason not to have the function call. It would be equivalent to teaching parameters and not showing the function call with the arguments. Or vice versa. I see no way in which having the function call shown here can hurt, on the contrary.

As said, unfortunately, parameters and arguments are sometimes used interchangeably, incorrectly if you ask me. Sometimes it is just the grammar, sometimes it is the words themself that are used incorrectly. They mean different things and they are not used grammatically in sentences the same either.


Use Destructuring Assignment to Pass an Object as a Function’s Parameters

In my opinion, this is grammatically incorrect.

It should be to not as. The object is passed to the parameter, not as the parameter. You can not pass an object as a parameter, you can pass it as an argument to a parameter.

Unfortunately, MDN has something like this as well:

Unpacking fields from objects passed as a function parameter.

Even Grammarly complains about that sentence.

In some cases, you can destructure the object in a function argument itself.

Here the word is simply used incorrectly. It should be a parameter. Also, make up your mind you just called it a parameter in the title.

When profileData is passed to the above function, the values are destructured from the function parameter for use within the function.

And now we are back to calling it a parameter.

Use destructuring assignment within the argument to the function half to send only max and min inside the function.

There are no arguments here as we do not have a function call anywhere. Again, why does it keep switching between argument and parameter?


The challenge we have on arguments and parameters uses the correct semantics and as expected shows both the definition and call site.

Passing Values to Functions with Arguments

Parameters are variables that act as placeholders for the values that are to be input to a function when it is called. When a function is defined, it is typically defined along with one or more parameters. The actual values that are input (or “passed”) into a function when it is called are known as arguments.


@Jaketh1 You can always open an issue on GitHub and see what people have to say. I certainly wouldn’t mind the arguments/parameters part being cleaned up.

1 Like

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