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

Tell us what’s happening:

Cannot move past this problem. I get the error that I need to add numbers[i] to the end of the text.innerText value and yet I’ve done that. I don’t understand what I’m doing wrong.

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

function pick(guess) {
  const numbers = [];
  while (numbers.length < 10) {
    numbers.push(Math.floor(Math.random() * 11));
  }
  text.innerText = "You picked " + guess + ". Here are the random numbers:\n";
  for (let i = 0; i < 10; i++) {
    text.innerText += "numbers[i]\n"
  }
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36

Challenge Information:

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

This is the string “numbers[i]”. Are you sure you want to add that string to innerText? Or do you want to add the value stored in numbers[i]?

I’m not sure how to do what you’re asking

Look at the line right before the for loop. How did you put a variable in a string?

Okay I got it, thanks!