freeCodeCamp / curriculum

The freeCodeCamp curriculum and lesson editor
Creative Commons Attribution Share Alike 4.0 International
81 stars 124 forks source link

fix(challenges): fix confusing destructuring es6 challenge #246

Closed joshalling closed 6 years ago

joshalling commented 6 years ago

ISSUES CLOSED: #213

Description

I updated ES6: Use Destructuring Assignment to Assign Variables from Objects so that it no longer requires the user to understand the difference between string primitives and string objects. It now follows the same theme as the challenge that follows.

This is the new contents of the challenge:

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

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

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

And this is a solution:

  const { tomorrow: tempOfTomorrow } = avgTemperatures;

I tested this on my local environment that was running the freeCodeCamp and learn repos.

Note: The code that I actually changed begins on line 707 and continues through line 753.

Pre-Submission Checklist

Checklist:

Closes #213

scissorsneedfoodtoo commented 6 years ago

@joshalling, sorry for the delay in reviewing this. Just checked it out and everything LGTM! :+1: :+1: