Skip to content

Swapping two items in a javascript array - Array.prototype.swap

Notifications You must be signed in to change notification settings

marko-jankovic/array-swap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

array-swap

Swapping two items in a javascript array - Array.prototype.swap

Install

$ npm install --save array-swap

Usage

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

var arr = ['apple', 'orange', 'banana', 'pear'];
arr.swap(1, 3);

// arr will be
// ['apple', 'pear', 'banana', 'orange']

License

MIT © Marko Jankovic

About

Swapping two items in a javascript array - Array.prototype.swap

Resources

Stars

Watchers

Forks

Packages

No packages published