Math.random() // Or something between 0 and 9: Math.floor(Math.random() * 10) // You can even make functions: function random(min, max){return Math.floor(Math.random() * (max - min)) + min}