HTML
<html><body>
<script type="text/javascript">
var movies = {
collectionType: "movies",
name: "The Avengers, Gardians of the Galaxy, Star Trek",
type: "Action, Comedy, Sci-fi",
releaseYear: "2012, 2014, 2009",
variable: "Movies"
};
var cars = {
collectionType: "cars",
name: "Chevorlet Malibu, Voltzwagon Bug, Honda Civic",
type: "Muscle, Luxury, Sports",
releaseYear: "1957, 1952, 2007",
variable: "Cars"
};
var videoGames = {
collectionType: "videoGames",
name: "Forza 5, Halo 3",
type: "Racing, First Person Shooter",
releaseYear: "2014, 2007",
variable: "Video Games"
};
var televisionShows = {
collectionType: "televisionShows",
name: "The Office, Jersey Shore",
type: "Comedy, Reality",
releaseYear: "2005, 2009",
variable: "Television Shows"
};
var shoes = {
collectionType: "shoes",
name: "Jordans, Pegasus",
type: "Basketball, Running",
releaseYear: "1985, 1983",
variable: "Shoes"
};
var collections = [movies, cars, videoGames, televisionShows, shoes];
function printCollection(collection) {
document.write(collection.variable + ":" + " " + collection.name + "," + " " + collection.type + "," + " " + collection.releaseYear + "|" + " ");
}
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 == type){
printCollection(collections[i]);
}
}
}
function add(collectionType, name, type, releaseYear, variable){
var newCollection ={
collectionType: collectiontype,
name: name,
type: type,
releaseYear: releaseyear,
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 type add.", "Type list, add, or search.");
if...