Skip to content

Instantly share code, notes, and snippets.

Number.prototype.times = function(string){
var result = '', times = this;
while(times--) {
result += string;
}
return result;
}
document.write((4).times('test'));
// taken from http://www.dreamincode.net/code/snippet154.htm
//
// Find the weaknesses, and clean up the code.
// Find at least 3 things you can make better!
//
// Test numbers (return true):
// 4111111111111111
// 378282246310005
// 5555555555554444