ES6: Use Destructuring Assignment to Assign Variables from Objects SEPT18

ES6: Use Destructuring Assignment to Assign Variables from Objects SEPT18
0

#1

I am trying to solve the ES6: Use Destructuring Assignment to Assign Variables from Objects challenge and I get this error message when I run the test:

// running tests
destructuring WITH reassignment was used
// tests completed

I must have made a mistake somewhere but I can’t find it. Here is my code:

const AVG_TEMPERATURES = {
  today: 77.5,
  tomorrow: 79
};

function getTempOfTmrw(avgTemperatures) {
  "use strict";
  // change code below this line
  const {tomorrow: tempOfTomorrow} = AVG_TEMPERATURES; // change this line
  // change code above this line
  return tempOfTomorrow;
}

console.log(getTempOfTmrw(AVG_TEMPERATURES)); // should be 79

What am I doing wrong?

Thanks for your help!


I cannot complete clause: 'destructuring with reassignment was used'
#2

You’re using the object used to test the function inside the function. The function takes an argument (avgTemperatures), and you can test it using the provided object AVG_TEMPERATURES, but you’re not to use that object in the function


#3

God! So simple once explained! Thanks a lot DanCouper!


#4

Thanks guys I was strugling with the same problem. Finally I got it :slight_smile:


#5

Same problem. Thank you for the explanation!


#6

good, thank you so much


#7

I made the same mistake! Thank you!


#9

I made the same mistake:neutral_face:


#10

I made the same error, some of these assignments are so simple but the way they are explained makes hard to understand sometimes. This one took me about an hour to solve.


#11

thank you @DanCouper same logic, same mistake :confused:


#12

@DanCouper Thanks man!!


#13

Thanks @DanCouper, I just got the same error