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 trialJohn Paul Luna
1,624 PointsCode will not display in brackets, even though other exercises have.
/* "random number generator" for treehouse course J. Paul Luna 08 Sept 16 */
alert('This is a user driven random number generator. ');
var userNumberInput = prompt('Please enter a random number.');
var topNumber = parseInt(userNumberInput);
alert('You selected the number: ' + userNumberInput);
var randomNumber = Math.floor(Math.random() * topNumber) + 1;
var message = "<p>" randomNumber " is a number between 1 and " + topNumber + ".</p>";
document.write(message);
I made sure to change the index.html to reflect this .js file.
1 Answer
Damien Watson
27,419 PointsHi, you're missing a few '+' symbols for concatenation:
var message = "<p>" + randomNumber + " is a number between 1 and " + topNumber + ".</p>";
Damien Watson
27,419 PointsDamien Watson
27,419 PointsSorry, what do you mean by 'Code will not display in brackets'?