This is one of those things that you know how to do in one language, say Python, and you find yourself wanting to use in another language, say JavaScript.

So, there is how you can achieve this in JavaScript:

console.log(Array(5).join('a'));
//output is aaaaa