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 trialCraig Watson
27,930 PointsOk now I'm certainly lost!
Hi,
I've tried going over my notes and even hunting the internet to help solve this challenge but at no point do i remember going over using conditionals with a function ......
Any help appreciated on this one , and i didn't know until to day so ill just mention it if you click the file icon with script.js it takes you to the challenge rather than me write it out...
Thanks anyone who tries to help!
Craig
1 Answer
Luke Glazebrook
13,564 PointsHey Craig!
This is the solution!
function max(num1, num2) {
if(num1 > num2) {
return num1;
} else {
return num2;
}
}
alert(max(20, 30));
Feel free to ask any questions about it if you don't understand it.
-Luke
Craig Watson
27,930 PointsCraig Watson
27,930 PointsHi Luke,
Thanks for your help, using your code task one passes but task two does not.. , after looking at your code in responses to task one it now see where i was going wrong , on task two it actually gives you the code needed with the hint to change math.random to max but then the task fails ..
any ideas ?
Robert Richey
Courses Plus Student 16,352 PointsRobert Richey
Courses Plus Student 16,352 Pointshere's code I used on this challenge
Luke Glazebrook
13,564 PointsLuke Glazebrook
13,564 PointsHey Craig!
Try out the code that I pasted in earlier! I updated it so that it will pass the second challenge as well!