Can you please explain what is happening in apply and map of the code below to produce the result of 000000
function array_filled(n, val)
{
return Array.apply(null, Array(n)).map(Number.prototype.valueOf,val);
}
console.log(array_filled(6, 0));
What I have tried:
I know that apply takes an object and values as parameter, but I am not sure wat is happening in apply(null, Array(n)).map(Number.prototype.valueOf,val); for the resul to show 000000