With EcmaScript 6 (ES2105), creating an array containing five nulls is as easy as this:
const arr = new Array(5).fill(null);
MDN Reference
With EcmaScript 6 (ES2105), creating an array containing five nulls is as easy as this:
const arr = new Array(5).fill(null);
MDN Reference