Last active
August 29, 2015 14:02
-
-
Save chrisbuttery/5e5d3c1ef72940389461 to your computer and use it in GitHub Desktop.
baha men lyrics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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