Can somebody help me?

Hi friends!
can someone help me with this code below?
I’m building a JavaScript weather app and I have a bug while I’m doing the hourly forecasting. Here is the code for the hourly forcasting .

function parseHourlyWeather({ hourly, current_weather }) {
    return hourly.time.map((time, index) => {
        return {
            timestamp: time * 1000,
            iconCode: hourly.weathercode[index],
            temp: Math.round(hourly.temperature_2m[index]),
            feelsLike: Math.round(hourly.apparent_temperature[index]),
            windSpeed: Math.round(hourly.windspeed_10m[index]),
            precip: Math.round(hourly.precipitation[index] * 100) / 100,
        }
    }).filter(({ timestamp }) => timestamp >= current_weather.time * 1000)
}

the bud is in the line of precipitation

 precip: Math.round(hourly.precipitation[index] * 100) / 100,

Thanks for your help.

hello and welcome back to fcc forum :slight_smile:

  • maybe try having a “pre-check” whether this “hourly.precipitation” actually exists or not, as per “error” message that what its refering to

happy learning :slight_smile:

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