Wiederholen Sie die Zeichenfolge in JavaScript
let text = 'Hello world!';
let result = text.repeat(4);
console.log(result);
Mehedi Islam Ripon
let text = 'Hello world!';
let result = text.repeat(4);
console.log(result);
let string = 'Plumbus'
let count = 3
string.repeat(count); // -> 'PlumbusPlumbusPlumbus'
var a="a";
var aaa=a.repeat(3); // "aaa"
// best implementation
repeatStr = (n, s) => s.repeat(n);
setInterval(function(){
}, 1000);
function repeatStr (n, s) {
return s.repeat(n)
}
/////////////////////////////similar///////////////////////////////////////////
repeatStr = (n, s) => s.repeat(n);