string repeat javascript
// best implementation
repeatStr = (n, s) => s.repeat(n);
string repeat javascript
// best implementation
repeatStr = (n, s) => s.repeat(n);
repeat a function javascript
setInterval(function(){
console.log("Hello");
console.log("World");
}, 2000); //repeat every 2s
javascript repeat function
/* The string.repeat(n) method constructs and returns a new string
with "n" number of copies. */
const chorus = "Because I'm happy. ";
console.log(`Chorus lyrics: ${chorus.repeat(3)}`);
// → "Chorus lyrics: Because I'm happy. Because I'm happy. Because I'm happy. "
// Use within a function
greeting = (n, words) => words.repeat(n);
console.log(greeting(5, "howdy "));
// → "howdy howdy howdy howdy howdy "
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us