Skip to content

return a new array with the element at the specified index removed

Notifications You must be signed in to change notification settings

blewisio/remove-at-index

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

remove-at-index

Remove an element at a specified index without modifying the original array.

Install

npm install remove-at-index

Usage

const removeAtIndex = require('remove-at-index');

const array = ['foo', 'bar', 'baz'];
const result = removeAtIndex(array, 0);
// result => ['bar', 'baz']
// array => ['foo', 'bar', 'baz']

API

removeAtIndex(array, i)

Removes the element at the specified index without modifying the original array.

array

Type: array (required)

The array to remove an element from. Does not mutate the array.

i

Type: number (required)

The index of the element to remove.

About

return a new array with the element at the specified index removed

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published