Question: *JAVASCRIPT* Help I just need to add code to make the app give an output from the NetflixContent table I have created. Here is the
*JAVASCRIPT* Help
I just need to add code to make the app give an output from the NetflixContent table I have created. Here is the code I have so far:
//
var contentList = [(getColumn("Netflix Content", "Type"))];
var allContentList = [(getColumn("Netflix Content", "Title"))];
var genreList = [(getColumn("Netflix Content", "Genre"))];
var countryList = [(getColumn("Netflix Content", "Country"))];
var NetflixContentIndex = allContentList.length-1;
//
var filteredContentList = [];
var filteredAllContentList = [];
var filteredGenreList = [];
var filteredCountryList = [];
//
onEvent("beginButton", "click", function( ) {
setScreen("customizePage");
});
//
onEvent("generateButton", "click", function( ) {
var typeInput = getText("contentInput");
var countryInput = getText("countryInput");
var genreInput = getText("genreInput");
for (var i = 0; i < contentList.length; i++) {
console.log(contentList);
}
listFormat();
setScreen("suggestionsScreen");
});
function updateScreen() {
setProperty("contentOutput", "text", filteredAllContentList[NetflixContentIndex]);
}
//
onEvent("homeButton1", "click", function( ) {
setScreen("homeScreen");
});
//
onEvent("homeButton2", "click", function( ) {
setScreen("homeScreen");
});
//
function listFormat() {
filter();
updateScreen();
}
//
function filter() {
}
//
//Input of user and start of fuctions
onEvent("generateButton", "click", function( ) {
listFormat();
});
//First function ran, runs filter and update screen every click of the butoon
function listFormat() {
filter();
updateScreen();
}
//Connects the filtered lists to the other lists by using a for loop and appending
function filter() {
for (var i = 0; i < NetflixContentIndex.length; i++) {
if (NetflixContentIndex[i] == 1) {
appendItem(filteredContentList, contentList[i]);
appendItem(filteredAllContentList, allContentList[i]);
appendItem(filteredGenreList, genreList[i]);
appendItem(filteredCountryList, countryList[i]);
}
}
}
//Update function that randomizes the index
function updateScreen() {
setProperty("contentOutput", "text", filteredAllContentList[NetflixContentIndex]);
}
//
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
