Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Javascript Random Jersey Headline Generator
<title>JS Headline Generator</title>
<script src=""></script>
<div class="container">
jQuery(document).ready(function() {
//declare arrays
var nouns = ['Chris Christie', 'Bruce Springsteen', 'S.P. Sullivan'];
var scandals = ['shuts down bridge', 'cancels Superbowl', 'caught with armadillo'];
var reasons = ['due to sex scandal', 'for payola scheme', 'in exchange for new Oreo flavor'];
//shuffle through contents of each array, picking one entry per array
var randNoun = nouns[Math.floor(Math.random() * nouns.length)];
var randScandal = scandals[Math.floor(Math.random() * scandals.length)];
var randReason = reasons[Math.floor(Math.random() * reasons.length)];
//place the random entry into the appropriate place in the HTML
jQuery("h1").append(randNoun + "&nbsp;");
jQuery("h1").append(randScandal + "&nbsp;");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment