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 trialDiego Acosta
926 PointsI know I'm messing up on the variable portion, can someone help me?
function max(velocity, speed) {
var randomNumber = Math.floor( Math.random() + speed + velcity);
if(velocity > speed) {
return velocity;
}
else {
return speed;
}
max(1,2);
1 Answer
Jamie Reardon
Treehouse Project ReviewerYou are creating unnecessary code for outside of the scope of the challenge. You have the code right in the function, now you just need to rectify it:
function max(velocity, speed) {
if (velocity > speed) {
return velocity;
} else {
return speed;
}
}
The second task requires you to use the alert
command and pass in max
function with two arguments (numbers), for example:
alert(max(5, 3));
Diego Acosta
926 PointsDiego Acosta
926 PointsThank you !