Random Array Item
📦 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.