Update snippet descriptions

This commit is contained in:
Isabelle Viktoria Maciohsek
2020-10-21 21:17:45 +03:00
parent 45aab31b91
commit 47276ac092
11 changed files with 17 additions and 13 deletions

View File

@ -5,7 +5,8 @@ tags: array,random,beginner
Returns a random element from an array.
- Use `Math.random()` to generate a random number, multiply it by `length` and round it off to the nearest whole number using `Math.floor()`.
- 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()`.
- This method also works with strings.
```js