Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

Array.prototype.fill()

2 tags 1 category

The fill() method of Array instances changes all elements within a range of indices in an array to a static value. It returns the modified array.

The fill() method is a mutating method. It does not alter the length of this, but it will change the content of this.

The fill() method fills empty slots in sparse arrays with value as well.

The fill() method is generic. It only expects the this value to have a length property. Although strings are also array-like, this method is not suitable to be applied on them, as strings are immutable.

Syntax example: fill(value)

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…