add-index
v1.0.0
Published
Add an item to an array and get its index.
Downloads
6
Maintainers
Readme
add-index
Add an item to an array and get its index.
Install
npm install add-index
Usage
const addIndex = require("add-index");
const array = [1, 2, 3, 4, 5];
addIndex(array, 6);
//=> 5
console.log(array);
//=> [1, 2, 3, 4, 5, 6]
API
addIndex(array, item)
array
Type: array
The array to add to.
item
Type: any
The item to add.