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 trialJeremy Barbe
8,728 PointsI don't see any variation
I'm not sure how to include workspace snapshots but i've scanned over my code and don't see anything different from what he's doing in the video. What's the issue?
var input = prompt("gimme a number");
var interger = parseInt(input);
var random = math.floor(Math.random() * interger) + 1;
var message = "<p>" + random + " is the magic number.</p>";
document.write(message);
2 Answers
Neil Docherty
10,418 PointsChecking the console we see an error: "Uncaught ReferenceError: math is not defined".
This show us that you've just made a typo. Missing uppercase 'M'.
Your code:
var random = math.floor(Math.random() * interger) + 1;
Correction:
var random = Math.floor(Math.random() * interger) + 1;
Jeremy Barbe
8,728 Pointsim dumb and tired....thank you....i need to use the console more
Christopher Vesti
1,622 PointsChristopher Vesti
1,622 Pointsand you mispelled in "integer"...it's not interger
Neil Docherty
10,418 PointsNeil Docherty
10,418 PointsThe spelling of the variable is consistent and would therefore have no impact on the code.
Jeremy could have just as easily called it "int" or "Z"; both of which are also an incorrect spelling of "integer". As long as it's clear what the variable describes then it's all good.