What is the best or most concise method for returning a string repeated an arbitrary amount of times?
(返回任意多次重复的字符串的最佳或最简洁的方法是什么?)
The following is my best shot so far:
(以下是到目前为止我最好的拍摄:)
function repeat(s, n){
var a = [];
while(a.length < n){
a.push(s);
}
return a.join('');
}
ask by brad translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…