What does `Array.prototype.fill(0, 1, 3)` do on `[1,2,3,4,5]`?

JavaScript Professional Easy

JavaScript Professional — Easy

What does `Array.prototype.fill(0, 1, 3)` do on `[1,2,3,4,5]`?

Key points

  • The method fills a specified range of indices with a specified value
  • The start index is inclusive, but the end index is exclusive
  • The original values at those indices are replaced

Ready to go further?

Related questions