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 trialsanjita sahu
Full Stack JavaScript Techdegree Student 638 Pointsvar myNumber = prompt('write your number'); var top = parseInt(myNumber); var randomNumber = Math.floor(Math.random()
this code is not working properly. i don't know why?
1 Answer
Kevin Gates
15,053 PointsHi there,
I'm using the Markdown CheatSheet to make your code easier to read:
var myNumber = prompt('write your number');
var top = parseInt(myNumber);
var randomNumber = Math.floor(Math.random()
If you look above, you are missing the closing parenthesis and semicolon for your Math.floor
function.
Should be:
var randomNumber = Math.floor(Math.random());
sanjita sahu
Full Stack JavaScript Techdegree Student 638 Pointssanjita sahu
Full Stack JavaScript Techdegree Student 638 Pointscode is like this var myNumber = prompt('write your number'); var top = parseInt(myNumber); var randomNumber = Math.floor(Math.random() * top) + 1; var message = '<p>' + randomNumber + ' is a number between 1 and ' + top + '. </p>'; document.write(message);
now its not working properly, i am getting result but that's not what i expected
Kevin Gates
15,053 PointsKevin Gates
15,053 PointsHi there! For your future responses, if you look below the text input field, you will see a reference to a Markdown Cheatsheet. It mentions there how you can add markdown so your code becomes easily readable.
You have this (I added notes as comments):
Which part is confusing for you?