display "feels like" if difference is >= 5

also use template literals (backticks) for better legibility of
concatenated strings
This commit is contained in:
John Bowdre 2024-02-09 21:05:40 -06:00
parent 00f4327e74
commit a537fb9fe9

View file

@ -37,12 +37,16 @@
// parse data // parse data
conditions = (res.conditions).toLowerCase(); conditions = (res.conditions).toLowerCase();
temp = (res.air_temperature)+ "°f ("+(((res.air_temperature-32)*5)/9).toFixed(1) + "°c)"; tempDiff = Math.abs(res.air_temperature - res.feels_like);
humidity = res.relative_humidity + "% humidity"; temp = `${res.air_temperature}°f (${(((res.air_temperature - 32) * 5) / 9).toFixed(1)}°c)`;
wind = res.wind_gust + "mph (" + (res.wind_gust*1.609344).toFixed(1)+ "kph) from " + (res.wind_direction_cardinal).toLowerCase(); if (tempDiff >= 5) {
precipToday = res.precip_accum_local_day + '" of rain today'; temp += `, feels ${res.feels_like}°f (${(((res.feels_like - 32) *5) / 9).toFixed(1)}°c)`;
}
humidity = `${res.relative_humidity}% humidity`;
wind = `${res.wind_gust}mph (${(res.wind_gust*1.609344).toFixed(1)}kph) from ${(res.wind_direction_cardinal).toLowerCase()}`;
precipToday = `${res.precip_accum_local_day}" of rain today`;
pressureTrend = res.pressure_trend; pressureTrend = res.pressure_trend;
pressure = (res.station_pressure).toFixed(2) + 'inhg and ' + pressureTrend; pressure = `${res.station_pressure}inhg and ${pressureTrend}`;
icon = res.icon; icon = res.icon;
// display data // display data