1

can any one help me out with this two in methods javaScript
a is resulting as [0,NaN,0,0,0] and b is resulting as [0,0,0,0,0] why a is having NaN in a array?

var a =new Array(5).fill('0').map(parseInt);
console.log(a);
var b =new Array(5).fill('0').map(parseFloat);
console.log(b);
  • with fill and zero, you get always a number. why `parseInt` or `parseFloat`? – Nina Scholz Jan 27 '17 at 10:28
  • 1
    Please search thoroughly before posting. Consider [this search](/search?q=%5Bjs%5D+map+parsefloat): It has at least three or four versions of this question on the first page. More on searching [here](/help/searching). – T.J. Crowder Jan 27 '17 at 10:34

0 Answers0