Skip to content

jakubgereg/draw-from-array

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Draw from Array

Removes one random element from array.

! Supplied array is mutated

Install

yarn add draw-from-array

or

npm install  draw-from-array

Example

let drawFromArray = require("draw-from-array");

let cards = [
  "Ace",
  "2",
  "3",
  "4",
  "5",
  "6",
  "7",
  "8",
  "9",
  "10",
  "Jack",
  "Queen",
  "King",
];

let drawn = drawFromArray(cards);

//drawn: ["Ace"]
//cards: ["2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King"]

About

Removes one random element from array.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •