Repeat Character Serveral Times in JavaScript

In Markdown, a header can be written as:

1
2
Header
======

This is a Setext-style headers, which are ‘underlined’ using equal signs (for
first-level headers) and dashes (for second-level headers)
. In order to
generate those underlined equal signs, a simple loop could be used to repeat
the character = several times. By the way, it is not necessary to have exact
number of the equal signs as the header length, but it just looks better. But
there is another way:

1
Array(heading.length + 1).join('=')

It is using the JavaScript Array global object to construct an empty Array
with the specified array length. Clever indeed!