random numbers between 1 and 10 javascript function code example Example: how to create a random number generator in javascript console.log(Math.floor(Math.random() * 10))