7 lines
194 B
JavaScript
7 lines
194 B
JavaScript
function array_filled(n, val)
|
|
{
|
|
return Array.apply(null, Array(n)).map(Number.prototype.valueOf,val);
|
|
}
|
|
|
|
console.log(array_filled(6, 0));
|
|
console.log(array_filled(4, 11));
|