上QQ阅读APP看书,第一时间看更新
Repeating strings
Let's finish with several new string-related functions. Most are pretty simple to understand, so the explanations will mostly be brief. For a complete list of all available string functions, both old and new, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String.
You can iterate any string using the .repeat(...) method:
"Hello!".repeat(3); // Hello!Hello!Hello!