From the course: JavaScript: Best Practices for Functions and Classes

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution: Destructure

Solution: Destructure - JavaScript Tutorial

From the course: JavaScript: Best Practices for Functions and Classes

Start my 1-month free trial

Solution: Destructure

(upbeat music) - [Instructor] The challenge here is to rewrite some references that we have to some of the nested values in the conditions object and to some of the values in the abbreviation array. So we have these four statements here in lines 49 through 52 that are giving shorter names, shorter references to some of those conditions values and then down here on 55 and 56, some more direct references to those two values in the abbreviation or abbr array. So first off, let's just get a sense of what's going on, what we expect to see from our code. So going live, looking in the console and so we're getting these values logged and we've got these degree symbols that are part of that abbreviation array, along with the Celsius and Fahrenheit abbreviations. And so we're showing a place name and we're also showing a humidity value. And so first up, we know we want to desctructure. We know we want to enforce that and so…

Contents