My students keep getting an error on line 35/36 in the Traversal Make app. I can’t find anything wrong with the code, can someone help?
Link to code:
Code:
// Build the Random Forecaster app
var cityList = [getColumn(“Daily Weather”, “City”)];
var forecastNumberList = [(getColumn(“Daily Weather”, “Forecast Number”))];
var conditionList = [getColumn(“Daily Weather”, “Main Condition”)];
var highTempList = [getColumn(“Daily Weather”, “High Temperature”)];
var lowTempList = [getColumn(“Daily Weather”, “Low Temperature”)];
var iconList = [(getColumn(“Daily Weather”, “Icon”))];
var filteredCityList = ;
var filteredConditionList = ;
var filteredHighTempList = ;
var filteredLowTempList = ;
var filteredIconList = ;
getTomorrowsWeather();
var tomorrowsWeather = 2;
onEvent(“forecastButton”, “click”, function( ) {
updateScreen();
});
function getTomorrowsWeather() {
for (var i = 0; i < forecastNumberList.length; i++) {
if (forecastNumberList[i] == tomorrowsWeather) {
appendItem(filteredCityList, cityList[i]);
appendItem(filteredConditionList, conditionList[i]);
appendItem(filteredHighTempList, highTempList[i]);
appendItem(filteredLowTempList, lowTempList[i]);
appendItem(filteredIconList, iconList[i]);
}
}
}
function updateScreen() {
var index = randomNumber(0, filteredCityList.length - 1);
setText(“highTempOutput”, filteredHighTempList[index]);
setText(“conditionOutput”, filteredConditionList[index]);
setText(“lowTempOutput”, filteredLowTempList[index]);
setProperty(“iconOutput”, “image”, filteredIconList[index]);
setText(“cityOutput”, filteredCityList[index]);
}