Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

The values aren't passing it my script. It took you ${attempts} tries to guess ${randomNumber}.

Here is the script. I thought it looks odd that let guess has no value but that's how it is in the video. https://teamtreehouse.com/library/track-guess-attempts-one-solution. The values are not passing into the ${attempts} and ${randomNumber} field

const main = document.querySelector("main"); const randomNumber = getRandomNumber(5); let guess; let attempts = 0; function getRandomNumber(upper) { return Math.floor(Math.random() * upper) + 1; } do { guess = prompt("Guess a number betwee 1 and 10."); attempts++; } while (parseInt(guess) !== randomNumber); main.innerHTML = "<h1>It took you ${attempts} tries to guess ${randomNumber}.</h1>";

1 Answer

Found the problem. I didn't have "back tics" after the main.inner.HTML.