Skip to content

Instantly share code, notes, and snippets.

@chrisbuttery
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisbuttery/5e5d3c1ef72940389461 to your computer and use it in GitHub Desktop.
Save chrisbuttery/5e5d3c1ef72940389461 to your computer and use it in GitHub Desktop.
baha men lyrics
var BahaMenLyrics = require('bahaMenLyrics');
var dogs = new BahaMenLyrics();
dogs.sing(); // "Who let the Dogs out?! Woof... Woof... Woof... Woof"
var goats = new BahaMenLyrics('Goats', 'Baaaa');
goats.sing(); // "Who let the Goats out?! Baaa... Baaa... Baaa... Baaa"
function BahaMenLyrics(things, sound){
this.things = things || 'Dogs';
this.sound = sound || 'Woof';
this.sounds = "";
var len = 4;
for (var i = 0; i < len; i++){
if (i === len - 1) {
this.sounds += this.sound;
} else {
this.sounds += this.sound + "... ";
}
}
};
BahaMenLyrics.prototype.sing = function(){
return "Who let the " + this.things + " out?! " + this.sounds;
}
module.exports = BahaMenLyrics;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment