Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions beers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
console.log("Time for a beer run...")

setTimeout(function() {
String.prototype.repeat = function( num )
{
return new Array( num + 1 ).join( this );
}

var BEER = "🍺 ";
var DOUBLEBEER ="🍻 ";

Number.prototype.beers = function() {
return BEER.repeat(this);
}

Number.prototype.doubleBeers = function() {
return DOUBLEBEER.repeat(this);
}

Number.prototype.pack = function() {
function genPack(rows, cols){
return (cols.beers() + "\n").repeat(rows)
}
if (this == 6) { return genPack(2, 3);}
else if (this == 12) {return genPack(2, 6);}
else if (this == 18) {return genPack(3, 6);}
else if (this == 24) {return genPack(4, 6);}
}

Math.random.beers = function(num) {
if (num == undefined) {var num = 10;}
return BEER.repeat(Math.floor(this() * num));
}

Date.now.beer = function(){
return true;
}

console.log('Done!');
}, 2500)