Skip to content

Instantly share code, notes, and snippets.

@dmethvin
Created July 22, 2011 16:13
Show Gist options
  • Save dmethvin/1099753 to your computer and use it in GitHub Desktop.
Save dmethvin/1099753 to your computer and use it in GitHub Desktop.
Better Simpsons
function createSimpsons() {
var theSimpsons = ['Bart', 'Homer', 'Marge', 'Maggy', 'Lisa'],
numberOfSeasons = 21,
avgEpisodesPerSeason = 22;
$("#title").append("The Simpson Family");
$("#details").append(
"<p>Number of seasons: " + numberOfSeasons + "</p>",
"<p>Episodes per season: " + avgEpisodesPerSeason + "</p>",
// most likely an incorrect count, since the average is unlikely to be a whole number?
"<p>Total number of episodes: " + (numberOfSeasons * avgEpisodesPerSeason) + "</p>"
);
$("#simpsons").append("<li>" + theSimpsons.join("</li><li>") + "</li>");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment