Destructuring argument in function

Tell us what’s happening:
I’m getting correct answer with this code but the test say “Destructuring should be used.” What i am doing wrong ??

  **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 = (stats) => {
const {max, min} = stats;
return (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; rv:88.0) Gecko/20100101 Firefox/88.0.

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

Link to the challenge:

You need to use destructuring in the function argument rather than inside of the function:

const profileUpdate = ({ name, age, nationality, location }) => {


Yeah i know that will solve my question but whats wrong in my code.

The problem with your code is that you used destructuring inside of the function instead of inside of the argument list of the function. Which is what I just said…

// running tests
Destructuring should be used.
// tests completed

This means “Destructuring should be used [inside of your function arguments rather than inside of your function]”

1 Like

Thanks for the help i get it.

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