Update snippet descriptions
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
---
|
||||
title: sample
|
||||
tags: array,random,beginner
|
||||
tags: array,string,random,beginner
|
||||
---
|
||||
|
||||
Returns a random element from an array.
|
||||
Gets a random element from an array.
|
||||
|
||||
- Use `Math.random()` to generate a random number.
|
||||
- Multiply it by `Array.prototype.length` and round it off to the nearest whole number using `Math.floor()`.
|
||||
|
||||
Reference in New Issue
Block a user