1. array-fill
Polyfill for Array.prototype.fill
array-fill
Package: array-fill
Created by: 1000ch
Last modified: Mon, 13 Jun 2022 03:28:14 GMT
Version: 1.2.0
License: MIT
Downloads: 1,008
Repository: https://github.com/1000ch/array-fill

Install

npm install array-fill
yarn add array-fill

array-fill Build Status

Polyfill for Array.prototype.fill.

testling badge

Usage

Functionally:

 var fill = require('array-fill');

console.log(fill([1, 2, 3], 4));
// => [ 4, 4, 4 ]

console.log(fill([1, 2, 3], 4, 1));
// => [ 1, 4, 4 ]

From Array object:

 require('array-fill/shim');

var array = [1, 2, 3];
array.fill(4, -3, -2);

console.log(array);
// => [ 4, 2, 3 ]

License

MIT © Shogo Sensui

Dependencies

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code