JSFiddle - React, Tailwind, and code Playground

by Daniel Lamb

JavaScript

// random value between 1 and 20
count = Math.floor(Math.random() * 19) + 1;

// create new array of n length
list = new Array(count);

// in contrast, a literal array works as expected
//var list = [undefined, undefined, undefined];

console.log('before', list.length, list[0]);

// fill list with data
list = list.map(function(){
    return { 'now': new Date().getTime() };
});

// array is not filled
console.log('after', list.length, list[0]);