Skip to content

Instantly share code, notes, and snippets.

@pat-eason
Last active October 16, 2015 16:23
Show Gist options
  • Save pat-eason/dc8adc80a4a4dbd4e77d to your computer and use it in GitHub Desktop.
Save pat-eason/dc8adc80a4a4dbd4e77d to your computer and use it in GitHub Desktop.
Javascript Jukebox: fun easter eggs in your console
JavascriptJukebox = {
letsGetThisPartyStarted: function(){
Array.prototype.randomElement = function () {
return this[Math.floor(Math.random() * this.length)];
};
var lyrics = this.lyrics().randomElement();
this.playItAgainTony(lyrics);
},
playItAgainTony: function(lyrics){
var i = 0;
//play til you can't play no mo
var play = setInterval(function(){
console.log('♩ ♫ ♪ ♬ '+lyrics[i]+' ♩ ♫ ♪ ♬');
i++;
if(i >= lyrics.length){
clearInterval(play);
}
}, 750);
},
lyrics: function(){
//create arrays of lyrics
var FreshPrince = [
"Now, this is a story all about how",
"My life got flipped-turned upside down",
"And I'd like to take a minute",
"Just sit right there",
"I'll tell you how I became the prince of a town called Bel Air",
"In west Philadelphia born and raised",
"On the playground was where I spent most of my days",
"Chillin' out maxin' relaxin' all cool",
"And all shootin some b-ball outside of the school",
"When a couple of guys who were up to no good",
"Started making trouble in my neighborhood",
"I got in one little fight and my mom got scared",
"She said 'You're movin' with your auntie and uncle in Bel Air'",
"I whistled for a cab and when it came near",
"The license plate said fresh and it had dice in the mirror",
"If anything I could say that this cab was rare",
"But I thought 'Nah, forget it' - 'Yo, home to Bel Air'",
"I pulled up to the house about 7 or 8",
"And I yelled to the cabbie 'Yo home smell ya later'",
"I looked at my kingdom",
"I was finally there",
"To sit on my throne as the Prince of Bel Air"
];
//feed me an array of lyrics
return [
FreshPrince
];
}
};
JavascriptJukebox.letsGetThisPartyStarted();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment