PDA

View Full Version : String statement equivelant



4fit?
01-31-2007, 01:31 PM
Hi all. Just starting to delve into JavaScript and was wondering if there is any kind of String statement built in. Something like String("J",10), which would result in a string of 10 Js.

Thanks in advance for any aid you all can provide.:D

Twey
01-31-2007, 03:43 PM
No. You can write one:
String.prototype.dup = function(len) {
var ret;
for(var i = 0; i < len; ++i)
ret += this;
return ret;
};... then "J".dup(10);