标签: javascript
可能重复: Repeat Character N Times
例如:
var x = 5, char = 'F'; // here return 'FFFFFF'
我该怎么做?
答案 0 :(得分:5)
var x = 5; var c = 'F'; return Array(x + 1).join(c);
来自Repeat Character N Times