From the course: Integrating Generative AI into JavaScript Web Projects

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Solution: Call functions and generate extended responses

Solution: Call functions and generate extended responses - JavaScript Tutorial

From the course: Integrating Generative AI into JavaScript Web Projects

Solution: Call functions and generate extended responses

(bright upbeat music) - [Instructor] So what we do here is completing the challenge. And we simply need to provide with more information that we get after doing this API call. So here, let's go back, and we're going to see that we've got the JSON objects. We want to access the weather information. And first, what we could do is to get the description, so that could be useful. And we can access it by going through JSON and then access this array, which is weather. It is right here, so this is an array. Then we're going to need to access the first object and finally access description. So let's do the same for also the current temperature. And we can access it by going JSON, and then it is main, we have it here, and then temperature. So we're going to use those to information. And we need to replace, for the temperature, I'm going to do Kelvin to Celsius. Let's see what's the suggestion from, we could use, you need if this is Celsius, but what you could do is also get a way to convert…

Contents