Learn Basic JavaScript by Building a Role Playing Game - Step 162

Tell us what’s happening:

Step 162

Inside your while loop, push a random number between 0 and 10 to the end of the numbers array. You can create this random number with Math.floor(Math.random() * 11).

Your code so far

function pick(guess) {
const numbers = ;
while (numbers.length < 10) {
let randomNumber = Math.floor(Math.random() * 11);
numbers.push(randomNumber);
}
}

#errorMessage

You should push the result of Math.floor(Math.random() * 11) to the end of the numbers array.

Challenge Information:

Learn Basic JavaScript by Building a Role Playing Game - Step 162

Try doing it without using a variable

2 Likes