Constructor Test

by Emily Humphrey

HTML

<div id="message"></div>

JavaScript

Team.prototype = {
    inLeague: function(){ return 2015 - this.founded;}
};

function Team(city, name, year, QB){
    this.city = city;
    this.name = name;
    this.founded = year;
    this.QB = QB;
}

var NYGiants = new Team("New York City", "Giants", 1924, "Eli Manning");

var messageHolder = document.getElementById("message");

messageHolder.innerHTML = "The "+NYGiants.name+" hail form "+NYGiants.city+", are led by their fearless Qaurterback "+NYGiants.QB+", and were founded in "+NYGiants.founded+". The "+NYGiants.name+" have been in the league "+NYGiants.inLeague()+" years.";