Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.