How can I add another solution to the hints page?

I want to contribute another solution for JS es6 ‘Use Destructuring Assignment to Assign Variables from Nested Objects’.

Just curious what your alternative solution is?

Hello there.

For future contributions, please wrap your solution within :

[details]
```
code goes here...
```
[/details]

Also, provide all of the necessary code to pass the challenge.

Also, when you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor ( </> ) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

1 Like

Can I make a PR for this or is it for staff only? Sorry, I’m new to FreeCodeCamp.

Oh alright! Not an altogether different solution but with less keystrokes and somewhat lucid in my opinion for this specific question :sweat_smile:

const LOCAL_FORECAST = {
  yesterday: { low: 61, high: 75 },
  today: { low: 64, high: 77 },
  tomorrow: { low: 68, high: 80 }
};

// Only change code below this line
  
const {low: lowToday, high: highToday} = LOCAL_FORECAST.today;

// Only change code above this line

The test cases don’t accept it but the ‘lowToday’ and ‘highToday’ bindings get the respective values assigned through destructuring only.

Thanks for the guidance :pray:t2:

Ah, in that sense it’s okay. :grin::v:t2:

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