js string.repeat code example
Example 1: js tan-1
Math.atan(2);
Example 2: encodeuricomponent js
var set1 = ";,/?:@&=+$";
var set2 = "-_.!~*'()";
var set3 = "#";
var set4 = "ABC abc 123";
console.log(encodeURI(set1));
console.log(encodeURI(set2));
console.log(encodeURI(set3));
console.log(encodeURI(set4));
console.log(encodeURIComponent(set1));
console.log(encodeURIComponent(set2));
console.log(encodeURIComponent(set3));
console.log(encodeURIComponent(set4));
Example 3: js string times
let string = 'Plumbus'
let count = 3
string.repeat(count);
Example 4: 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 5: string repeat javascript
repeatStr = (n, s) => s.repeat(n);
Example 6: repeat js
repeatStr = (n, s) => s.repeat(n);