Skip to content
This repository has been archived by the owner on Sep 25, 2019. It is now read-only.

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

Conversation

joshalling
Copy link
Member

@joshalling joshalling commented Aug 13, 2018

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

  • Your pull request targets the dev branch.
  • Branch starts with either fix/, feature/, or translate/ (e.g. fix/challenge-tests)
  • All new and existing tests pass the command npm test.
  • Use npm run commit to generate a conventional commit message.
    Learn more here: https://conventionalcommits.org/#why-use-conventional-commits
  • The changes were done locally on your machine and NOT GitHub web interface.
    If they were done on the web interface you have ensured that you are creating conventional commit messages.

Checklist:

  • Tested changes locally.
  • Addressed currently open issue (replace XXXXX with an issue no in next line)

Closes #213

@scissorsneedfoodtoo scissorsneedfoodtoo merged commit 1a4f6a8 into freeCodeCamp:dev Aug 21, 2018
@scissorsneedfoodtoo
Copy link
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ES6: Use Destructuring Assignment to Assign Variables from Objects
2 participants