// Strings:/*www.java2s.com*/// // Repeats a string.// // eg: alert( "string to repeat\n".repeat( 4 ) );// String.prototype.repeat = function( num )
{
return new Array( num + 1 ).join( this );
}
Javascript String repeat( num )
// Prototype methods for Javascripts String object.// http://snipplr.com/view/699/stringrepeat/String.prototype.repeat = function( num ) {
for( var i = 0, buf = ""; i < num; i++ ) buf += this;
return buf;//www.java2s.com
}
Javascript String repeat( num )
String.prototype.repeat = function( num ) {
return new Array( num + 1 ).join( this );
};
getTimeInNiceFormat = function(t) {
var y = t.getFullYear().toString();
var m = ('0' + (t.getMonth() + 1)).slice(-2);
var d = ('0' + t.getDate()).slice(-2);
var h = ('0' + t.getHours()).slice(-2);
var i = ('0' + t.getMinutes()).slice(-2);
var s = ('0' + t.getSeconds()).slice(-2);
var res = "";
if (y > 1970) {
res = y + "-" + m + "-" + d + " ";
}
return res + h + ":" + i + ":" + s;
};
Javascript String repeat( num )
var mongoose = require("mongoose"),
fs = require('fs');
String.prototype.repeat = function( num )
{
return new Array( num + 1 ).join( this );
}