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

Am i missing something?

For some reason this code is not running

var randNo = Math.floor(Math.random() * 6 ) + 1; var guess = prompt("Guess The Number between 1 and 6"); if (parseInt(guess) === randNo) { document.write("You Guessed it. it's " + randNo); } else { document.write("try again! " + "it's " + randNo); }

Hi Modestas,

I just checked your code and it should work. Make sure to include the script in the html code.

Thanks, i guess my work space was glitched or something

1 Answer

Hello Modestas Kiudulas There is nothing wrong with your JavaScript Code . I just checked it and it worked. So jsut make sure you attach the javascript file in your html file properly