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 trialRui Neves
3,393 PointsMy code and how do I organize it.
var myNum = Math.floor(Math.random() * 5) + 1; //Generates a random number. console.log(myNum); //Log it to the console to make sure is not the same as the user wrote.
var guessNum = prompt('Try to guess the number I am thinkin of, between 1 and 5!'); // Question the user for a number.
if(parseInt(guessNum) === myNum){ //Checks if the number from th user is the same as the on generated. document.write('Congrats! You Guess it!'); //Give the answer. } else { document.write('Sorry, not this time! The number was ' + myNum + ".")//Give the answer with the rigth number.
1 Answer
Antony .
2,824 PointsFirst type 3 back ticks on top of your code followed by the programming language you are using, then put 3 more backticks at the bottom of your code. So like this
```javascript
//Put 3 more backticks at the bottom.
Antony .
2,824 PointsAntony .
2,824 PointsYou can also use the Markdown Cheatsheet.
https://teamtreehouse.com/community/howto-guide-markdown-within-posts