Untitled Document

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

var maxList = getColumn("Board Games", "Maximum players");

var nameList = getColumn("Board Games", "Name");

//Maximum Input
onEvent("maxInput", "input", function( ) {
filter(getText("maxInput"));
updateScreen();
});

//Function
var filterGameList = [];
var game;
function filter(maxInput) {
for (var i = 0; i < nameList.length; i++) {
game = nameList[i];
if (maxInput == maxList[i]) {
appendItem(filterGameList, game);
}
}
}

function reset() {
filterGameList = [];
}

//Update Screen
function updateScreen() {
var text = "Board Games: " + "\n" + filterGameList;
setText("text_area1", text);
reset();
}

You might also like