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 trialAgnes Caringal
6,239 PointsAlert Function!...How can I make. Anyone can help me to solve this
regarding alert() method
function max(num1, num2) {
if(num1 > num2) {
return num1;
} else {
return num2;
}
}
alert(max(num1, num2);
3 Answers
Ion Jones
11,299 PointsYou're close! In your alert, pass in some real numbers to make the function work.
function max (num1, num2) {
if (num1 > num2) {
return num1;
}
return num2
};
alert (max(2,3));
Agnes Caringal
6,239 PointsThank you sir Ion Jones :)
---function returns the message variable: ---
function greeting( name ) { var message = "Hello " + name; }
Agnes Caringal
6,239 Pointsreturn greeting()
what's the problem with my code? thanks
Ion Jones
11,299 PointsHi Agnes! You need to pass a name into your greeting function.
Like so:
function greeting(name) {
var message = "Hello " + name;
};
greeting("Agnes");
Also, don't forget the semi-colon at the end of your function call.
Agnes Caringal
6,239 Pointsthank you so much sir Ion Jones :)
Agnes Caringal
6,239 PointsAgnes Caringal
6,239 PointsThank you so much Sir Ion Jones. How about this?
Given this function, write the code to call it: function warning() { alert('Warning, warning, warning!'); } ;
Ion Jones
11,299 PointsIon Jones
11,299 PointsTo call that function:
warning();
That's it.