How to repeat a string multiple times by js
This article mainly shows you "js how to achieve repeated a string", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "js how to repeat a string many times" this article.
Repeat a string multiple times
To repeat the same characters multiple times, we can use for loops and add them to the same loop. How to abbreviate it?
/ / Bad let test =''; for (let I = 0; I < 5; I + +) {test + = 'test,';} console.log (str); / / test,test,test,test,test,//good console.log (' test,'.repeat (5)) are all the contents of the article "how to repeat a string multiple times". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!