You can do it by using String.prototype.repeat(). According to MDN
The repeat() method constructs and returns a new string which contains the specified number of copies of the string on which it was called, concatenated together.
It takes a count parameter as it's the only argument which is
An integer between 0 and +Infinity, indicating the number of times to repeat the string.
And returns
A new string containing the specified number of copies of the given string.
let str = "#";
let newStr = str.repeat(5);
console.log(newStr);