Random Number
This is the standard random number generator I use.
01function get_random_number(max_number) {02 return Math.floor(03 (Math.random() * max_number) + 104 )05}
..
console.log(get_random_number(5))
->
It works by setting a maximum number and then generates a number between 1 and whatever was set. It's inclusive so both 1 and whatever the max number is are possible values.
Here's the same thing without being wrapped in a function:
01const max_number = 502const random_number = Math.floor(03 (Math.random() * max_number) + 104)
..
console.log(random_number)
->