How to fill Array of the given length with the same values in javascript ?

Suppose, if you want to create an Array of length ‘5’ and fill it with zeros then we can write the following code.

In the same way, If we want to create an Array of length ‘3’ and fill it with the text ‘javascript’ then we can write the following code.

Leave a comment