r/javascript • • Mar 10 '21

Important array methods in JavaScript - HtoStudios

https://www.htostudios.com/articles/Important-array-methods-in-javascript/

[removed] — view removed post

0 Upvotes

3 comments sorted by

View all comments

3

u/[deleted] Mar 10 '21

Huh never heard of Array.prototype.fill(), is it new?

Would be useful with the Array constructor

Array(100).fill(null);

instead of

[...Array(100)].map(e => null);

1

u/_default_username Mar 10 '21

That's what I use fill for.