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.