How to initialize a new array with values in JavaScript
By Flavio Copes
Learn how to initialize a new JavaScript array of a given length filled with the same value, using the Array() constructor with the ES6 fill() method.
~~~
Simple solution:
Array(12).fill(0)
fill() is a new method introduced in ES6.
~~~
Related posts about js: