Skip to content

Functions append() and prepend(), which are alternatives to Array.push() and Array.unshift()

License

Notifications You must be signed in to change notification settings

writetome51/array-append-prepend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

prepend(value, array): void

Adds value to beginning of array. Alternative to array.unshift(value)

append(value, array): void

Adds value to end of array. Alternative to array.push(value)

Examples

let arr = [1, 2, 3];  
prepend(10, arr); 
// arr === [10, 1, 2, 3] 

arr = [1, 2, 3];
append(30, arr); 
// arr === [1, 2, 3, 30]

Installation

npm i @writetome51/array-append-prepend

Loading

import {prepend, append} from '@writetome51/array-append-prepend';

About

Functions append() and prepend(), which are alternatives to Array.push() and Array.unshift()

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages