在第 16 行 setText 中,它说 TypeError: Cannot read property 'toString' of undefined 并且我不知道如何解决这个问题。同样在第 30 行,最后一个 for 循环说 i 已经定义但我不确定如何定义。
//lists
var teamNames = getColumn("NBA Teams", "Team");
var teamChampionships = getColumn("NBA Teams", "Championship wins");
var teamConference = getColumn("NBA Teams", "Conference");
//filteredList
var filteredNames = [];
onEvent("userButton", "click", function( ) {
updateScreen();
});
//updates screen to show filtered team names
function updateScreen(){
var textOutput = "";
var championship = getColumn("NBA Teams", "Championship wins");
textOutput = findMatches(championship);
setText("teamsArea", textOutput);
}
for (var i = 0; i < teamNames.length; i++) {
if (teamConference == getText("conferenceDropdown") && teamChampionships == getNumber("championshipInput")) {
appendItem(filteredNames, teamNames[i]);
}
}
//macthes data input with teams and returns it
//championship (integer) - user inputs numbert of championshops
//matches (string) - name of matching teams based on inputed date
function findMatches(championship) {
var teamNames = getColumn("NBA Teams", "Team");
var matches = filteredNames[i];
for (var i = 0; i < teamNames.length; i++) {
if (championship == getNumber("championshipInput")) {
return matches;
}
}
}