I want to generate n' number of same characters which will be stored in a var.
Like gggggggggggggggggggg
But not using a separate function.
Is there any api for that?
I want to generate n' number of same characters which will be stored in a var.
Like gggggggggggggggggggg
But not using a separate function.
Is there any api for that?
You can use repeat function for Strings in JS. It works like this,
const str = "some string";
console.log(str.repeat(n));
This will repeat str , n number of times