function getHighLowTemps() {
const statesToTemps = {}
for (const state in statesWeeklyForecast) {
const highLows = {};
const futureCasts = statesWeeklyForecast[state];
var count = 0;
for (const index in futureCasts) {
const currentCast = futureCasts[index];
if (currentCast["name"].includes("Night") || currentCast["name"].includes("night")) {
console.log(state)
console.log(currentCast["name"] == "Tonight")
if ((currentCast["name"] == "Tonight" || currentCast["name"] == "Overnight")) {
if (highLows[count] == null) {
highLows[count] = {};
}
highLows[count][1] = currentCast["temperature"];
if (count == 0) {
count++;
}
} else {
highLows[count - 1][1] = currentCast["temperature"];
}
} else {
if (highLows[count] == null) {
highLows[count] = {};
}
highLows[count][0] = currentCast["temperature"];
if (count != 0) {
count++;
}
}
}
statesToTemps[state] = highLows;
}
return statesToTemps;
}