Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Jessica Musick-Sanchez
2,392 Pointsjavascript functions larger number challenge
pretty sure my if else statement is fine but friend couldnt explain what i did wrong in my first section of code
function getRandomNumber( a, b ) {
const largerNumber = math.random();
return largerNumber;
}
console.log(getRandomNumber(30, 50));
if ( a > b ) {
console.log(`${a} is larger than ${b}`);
} else {
console.log(`${b} is larger than ${a}`);
}
1 Answer

Steven Parker
220,526 PointsIf the page linked to the "view challenge" button is the one you're working on, you've headed in a very different direction from the instructions.
For this challenge, you will make a function named "max" to compare two numbers and return one of them.
You won't need a "getRandomNumber" function (or do anything random at all), and you won't need to log anything to the console until you get to task 2.
Jessica Musick-Sanchez
2,392 PointsJessica Musick-Sanchez
2,392 Pointsmy husband helped me through that challenge and now it's giving a new error. not sure where I'm misunderstanding things.
Steven Parker
220,526 PointsSteven Parker
220,526 PointsMaybe hubby had just read the instructions for a different challenge with random numbers.
Start a new question where you can show your code as it is now if you need help with it.
Jessica Musick-Sanchez
2,392 PointsJessica Musick-Sanchez
2,392 PointsHe's a senior dev so I'm nowhere near his level and he hasn't done this basic of stuff in quite a while but thanks anyways and will do!