Code Monkey home page Code Monkey logo

random-array-item's Introduction

Random Array Item

Build Downloads this Week Bundle Size Version

Numify

๐Ÿฆ„ Simple utility to fetch a random item from an array.

๐Ÿ“ฆ Requirements

Node.js 12.x LTS or 14.x (or Higher) LTS

โœจ Installation

Install the NPM Package with the below command:

npm install random-array-item --save

(or)

Install with Yarn:

yarn add random-array-item

๐Ÿ–Š๏ธ Usage

Import the module in your project:

// Commonjs Import
var { randomArrayItem } = require("random-array-item");

// or ES6 import
import { randomArrayItem } from "random-array-item";

๐Ÿ’ก Example

Pass the Array to the function

import { randomArrayItem } from "random-array-item";

let array = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"];
let randomItem = randomArrayItem(array);
console.log(randomItem);

โ˜‘๏ธ Example Output

7

๐Ÿ›ก๏ธ LICENSE

  • MIT

๐Ÿ’š Message

I hope you find this useful. If you have any questions, please create an issue.


๐Ÿ’ฐ Help me with your donation

Buy Me A Coffee

random-array-item's People

Contributors

mcnaveen avatar

Stargazers

Santhosh Veer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.