ITeye博客

ES6新标准-字符串的扩展repeat()

小丑鱼0703 · 2015-03-28 16:15 · js-String · Web前端 · Markdown

repeat() 返回一个新字符串,表示将原字符串重复n次。

   

      早先通过join()实现了字符串连续复制,现在ES6中封装好了我们可以直接使用了~

 

"hello".repeat(2) // "hellohello"

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。