Hi everyone! Excited to be here!
I'm working on a basic JavaScript 'app' that just runs in the JS console on my browser. I'm trying to figure out how to generate random numbers as a part of it, but am having a hard time.
Any suggestions?
Hi everyone! Excited to be here!
I'm working on a basic JavaScript 'app' that just runs in the JS console on my browser. I'm trying to figure out how to generate random numbers as a part of it, but am having a hard time.
Any suggestions?
For further actions, you may consider blocking this person and/or reporting abuse
Marak -
Ethan Ethan -
anorakmuesli -
IllyaZaharov -
Once suspended, thecomet will not be able to comment or publish posts until their suspension is removed.
Once unsuspended, thecomet will be able to comment and publish posts again.
Once unpublished, all posts by thecomet will become hidden and only accessible to themselves.
If thecomet is not suspended, they can still re-publish their posts from their dashboard.
Once unpublished, this post will become invisible to the public and only accessible to Hailey.
They can still re-publish the post if they are not suspended.
Thanks for keeping CodeNewbie Community 🌱 safe. Here is what you can do to flag thecomet:
Unflagging thecomet will restore default visibility to their posts.
Oldest comments (3)
Hi! The way I do it is by using the "random" function on the built-in Math object. There are a bunch of great examples on MDN, but in a nutshell:
This ^^^
Also, you can write (Math.random() * x) + 1 to generate a number between 1 and x.
Hi Hailey! We are happy that you joined the coders community! Welcome!
This is a function to get random numbers from 0 to 10:
const randomNumbers = () => Math.floor(Math.random() * 10);