multiply string js code example
Example 1: javascript multiline string
const multilineString = `This
is
a
multiline
string
in
javascript`;
Example 2: js multiply string
let myString = 'test';
myString.repeat(3);
Example 3: js string times
let string = 'Plumbus'
let count = 3
string.repeat(count);
Example 4: javascript multiline string
var MultilineString = `This
is
a multiline
string`;
var MultilineString = 'This \n\
is \n\
a multiline \n\
string';
Example 5: how to repeat a string in javascript
function repeatStringNumTimes(string, times) {
var repeatedString = "";
while (times > 0) {
repeatedString += string;
times--;
}
return repeatedString;
}
repeatStringNumTimes("abc", 3);
Example 6: repeat js
repeatStr = (n, s) => s.repeat(n);