fillAll
The fillAll() function replaces all the elements of an array with a single value and returns the result without altering the input.
Interactive example
Syntax
Classic signature
typescript
function fillAll<
GenericElement extends unknown
>(
input: readonly unknown[],
element: GenericElement
): GenericElement[]Curried signature
typescript
function fillAll<
GenericElement extends unknown
>(
element: GenericElement
): (input: readonly unknown[]) => GenericElement[]Parameters
input: Source array.element: Value to copy at each position (the output type is based on this value).
Return value
A new array where all elements equal element, typed from that value. The initial array remains unchanged.
