Java script

by Jessica Brady

JavaScript

var CaliforniaAllstars = {
  collectionType: "CaliforniaAllstars",
	teams: "Lady Bullets, Smoed, Snipers",
  Worlds: "yes, yes, no",
	Year: "2013, 2015, 2014",
	variable: "CaliforniaAllstars"
};
var Gymtyme = {
  collectionType: "Gymtyme",
	teams: "Pink, Black, Blink",
 Worlds: "yes, yes, no",
  Year: "2014, 2013, NA",
	variable: "Gymtyme"
};
var OregonDreamTeams = {
	collectionType: "OregonDreamTeams",
	teams: "Dream, Vanity",
	Worlds: "no, no",
	Year: "NA, NA",
	variable: "OregonDreamTeams"
};
var SoCalSelect = {
	collectionType: "SoCalSelect",
	teams: "Revenge, Blessed",
	Worlds: "no, yes",
	Year: "NA, 2009",
	variable: "SoCalSelect"
};
var Platinum = {
	collectionType: "Platinum",
	teams: "Topaz, Royalty",
	Worlds: "no, no",
	Year: "NA, NA",
	variable: "Platinum"
};

var collections = [CaliforniaAllstars, Gymtyme, OregonDreamTeams,SoCalSelect, Platinum];

function printCollection(collection) {
    document.write(collection.variable + ":" + " " + collection.team + "," + " " + collection.Worlds + "," + " " + collection.Year + "|" + " ");
}

function list() {
	var collectionsLength = collections.length;
	for (var i = 0; i < collectionsLength; i++) {
		printCollection(collections[i]);
	}
}

function search(type) {
    for (var i = 0; i < collections.length; i++){
        if (collections[i].collectionType == Worlds){
            printCollection(collections[i]);
        } 
    }
}

function add(collectionType, teams, Worlds, Year, variable){
    var newCollection ={
			collectionWorlds: collectionWorlds,
			teams: teams,
  		Worlds: Worlds,
  		Year: Year,
			variable: variable
    }
	collections[collections.length]=newCollection;
}

var userInput = prompt("What collection are you looking for? If you want to see all collections type list. If you are looking to add a collection then Worlds add.", "Type list, add, or search.");
	if (userInput === "list") {
		list()
	}
	else if (userInput === "search") {
		var userChoice = prompt("Please enter the collection you are...