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) Making Decisions with Conditional Statements Build a Random Number Guessing Game

Tijl Declerck
Tijl Declerck
1,211 Points

Can't open it in the web browser

Same damn problem every time. Shouldn't it at least open the prompt window? really frustrating.

''' var randomNumber = math.floor(Math.random()*6)+1;

var answer = prompt('I have a number in my head between 1 and 6, can you guess it?');

if (parseInt(answer) === randomNumber){ document.write("<p> You're right! </p>") } else{ document.write("<p> WRONG! </p>") }

'''

2 Answers

Doegena Fennich
Doegena Fennich
8,974 Points

change math.floor to Math.floor and you're good to go.

Tijl Declerck
Tijl Declerck
1,211 Points

I changed it and it's still not working.

Doegena Fennich
Doegena Fennich
8,974 Points

Weird, it works on http://jsbin.com/rogopasuwo/edit?js,output. maybe you should relaunch your workspace sometimes it gets a lil buggy. If it still not works check if you put the right name of the js file in the HTML script tag.