Update formatting

This commit is contained in:
Isabelle Viktoria Maciohsek
2022-01-30 18:22:35 +02:00
parent 9acb7dadc1
commit c08892459a
8 changed files with 12 additions and 11 deletions

View File

@ -8,8 +8,9 @@ lastUpdated: 2020-10-22T20:24:04+03:00
Generates a random string with the specified length.
- Use `Array.from()` to create a new array with the specified `length`.
- Use `Math.random()` generate a random floating-point number, `Number.prototype.toString(36)` to convert it to an alphanumeric string.
- Use `String.prototype.slice(2)` to remove the integral part and decimal point from each generated number.
- Use `Math.random()` generate a random floating-point number.
- Use `Number.prototype.toString()` with a `radix` value of `36` to convert it to an alphanumeric string.
- Use `String.prototype.slice()` to remove the integral part and decimal point from each generated number.
- Use `Array.prototype.some()` to repeat this process as many times as required, up to `length`, as it produces a variable-length string each time.
- Finally, use `String.prototype.slice()` to trim down the generated string if it's longer than the given `length`.