JavaScript Array method: fill()
[this page | pdf | back links]
The fill() method (when applied to a JavaScript
array) sets
elements of the array to a specified value.
It
has the following syntax with the following parameters. It returns an array
(the changed array).
array.fill(value, start, end)
|
Parameter
|
Required / Optional
|
Description
|
|
value
|
Required
|
The value to fill the
array with
|
|
start
|
Optional
|
The index position
where elements start to be filled (default is zero)
|
|
end
|
Optional
|
The index position
where elements stop being filled (default is array.length
|
NAVIGATION LINKS
Contents | Prev | Next | JavaScript Arrays