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 JavaScript Basics (Retired) Working With Numbers The Random Challenge Solution

Please can you check why my code doesn't run.

My code runs fine from line 1 - 4. The prompts appear. However when I add the rest of the code (from line 5 onwards), nothing runs. I cannot see where I have made an error. Screenshot attached. https://w.trhou.se/f3uovufzve Many thanks in advance. Elissa.

4 Answers

Hey Elissa,

Kristian Terziev is right. You have a typo on Line 6. And you changed it in that new workspace... but it's still wrong, i.e. it now has a different typo. This is how it should look:

var message = '<p>' + randomNumber + ' is a number between  ' + bottomNumber + ' and' + topNumber + '</p>';

Hello Elissa,

You forgot one + on line 6. Hava a look after the bottomNumber variable.

HI Kristian,

Thanks so much, but I corrected that and it doesn't make a difference. i wouldn't think that an error in the message string would stop the code from running in any case? https://w.trhou.se/2rpeyvj5ei

HI Kristian,

Thanks so much, but I corrected that and it doesn't make a difference. i wouldn't think that an error in the message string would stop the code from running in any case? https://w.trhou.se/2rpeyvj5ei

Presley Cobb
Presley Cobb
9,214 Points

Code works fine for me no error or anything in the console.