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 trialLuqman Shah
3,016 PointsPlease review my code
Please review my code before I proceed to the solution video, thank you.
First Method:
function getRn () {
var randomNumber = Math.floor(Math.random() * (6 - 1 + 1)) + 1;
alert(randomNumber);
}
getRn();
Second Method:
function getRn (numberOne, numberTwo) {
var randomNumber = Math.floor(Math.random() * (6 - 1 + 1)) + 1;
return alert(randomNumber + ' is a number between ' + numberOne + ' and ' + numberTwo);
}
getRn(3, 4);
3 Answers
Steven Parker
231,275 PointsYour second method takes 2 arguments, but it does not use them in the formula to control the number being picked. If you pass values that are both higher than 6, what the alert shows will never be true.
It might be helpful to proceed to the next video, and compare your code with the instructor's as a way to evaluate it yourself.
Luqman Shah
3,016 PointsI literally failed every challenge in this course............
Steven Parker
231,275 PointsIf you would like help with a specific challenge, start a question from within the challenge using the "get help" button, which should automatically format and attach your code with a link to the challenge to the question.
Luqman Shah
3,016 PointsI know that's what I've been doing, and you've helped me with the majority of those challenges, thanks btw! I watch the videos a couple times, I take notes, I follow along in work-space, I ask questions, I pass the quizes and code challenges(the other code challenges, not the workspace code challenges, the workspace code challenges are the ones I always seem to be stuck with), I wonder if this is the case for everybody else, or do people just nail the work space challenges in a breeze.
Steven Parker
231,275 PointsYou might find this episode of The Treehouse Show helpful. It discusses learning styles and blocks, and ways to deal with them.
Stephen Chamroeun
7,095 PointsYou shouldn't worry too much about it, because you're not the only one. JavaScript is a challenging language, but you just have to keep at it. Honestly, I've watched some of these JavaScript videos multiple times until the concept sticked and I feel like I have a WHOLE lot more understanding of it now. You should watch the video that Steven suggested if you haven't done so yet. It might help you with your niche in learning the content. Happy coding and best of luck to you!
Michael Johnson
6,340 PointsNope not just you. I fail these too.
Matthew Long
28,407 PointsMatthew Long
28,407 PointsI reviewed your code, but looks like you deleted your post.