Tell us what’s happening:
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).
function pick(number) {
const numbers = ;
while (numbers.length < 10) {
const randomNumber = Math.floor(Math.random() * 11) ;
numbers.push(randomNumber);
}
}
I have written this code but I can’t understand where is the problem .
Your code so far
<!-- file: index.html -->
/* file: script.js */
// User Editable Region
function pick(number) {
const numbers = [];
while (numbers.length < 10) {
const randomNumber = Math.floor(Math.random() * 11) ;
numbers.push(randomNumber);
}
}
// User Editable Region
/* file: styles.css */
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Challenge Information:
Learn Basic JavaScript by Building a Role Playing Game - Step 164