Array.prototype.fill
can fill up an array with one value
fill(0)
will populate 0
into each array element
fill only changes content, adds no new elements
second parameter to fill()
is the position where to start filling
third parameter is the position where filling stops
Links
A discussion in a github issue, about how to use this kata.
API doc on MDN.
Required Knowledge
- `const` declaration (Block scope)
Related Katas
Array API
array.sort()
basicsarray.sort()
can take a compare functionarray.shift()
(as introduced in ES3)array.push()
(as introduced in ES3)Array.from()
Array.of()
array.fill()
array.find()
array.findIndex()
array.entries()
array.keys()
array.values()
array.includes()
array.toReversed()
Difficulty Level
TBD
First Published
28 April 2015
Stats
4 tests to solve