Array.fill Method In JavaScript



Array.fill Method In JavaScript

Array.fill Method In JavaScript

If you want to repeat a piece of code a certain number of times, you can use the Array.fill() method. This method takes a value and a length as arguments and returns an array with the value repeated the number of times specified by the length argument.