default array values
You can use the fill
function on an array:
Array(24).fill(0)
Note: fill
was only introduced in ECMAScript 2015 (alias "6"), so as of 2017 browser support is still very limited (for example no Internet Explorer).
var a = Array.apply(null, Array(24)).map(function() { return 0 });
// or:
var a = Array.apply(null, Array(5)).map(Boolean).map(Number);