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 trialMUZ140057 Dumisani Nyamusa
8,029 Pointscreating reusable codes with functions
Given this function, write the code to call it:
function warning() { alert('Warning, warning, warning!'); }
4 Answers
Christian Linnerud
7,312 PointsType this and you will pass this question.
warning()
The semi colon ; is already typed into the questions.
Omar Ocampo
3,166 PointsThanks, very helpful
Craig Watson
27,930 PointsHi,
To call the function simply write the name of the function followed by brackets and semi colon...
//name of function alertRandom
function alertRandom() {
//function
var randomNumber = Math.floor( Math.random() * 6 ) + 1;
alert(randomNumber);
}
//call function alertRandom
alertRandom();
Hope this helps!
Craig
HIDAYATULLAH ARGHANDABI
21,058 Pointsit is warning ();
Jonathan Dalby
8,528 PointsHow annoying, this was driving me nuts !!!! All about attention to detail I guess, dammit!
mandana mirzaii
Courses Plus Student 1,918 Pointsmandana mirzaii
Courses Plus Student 1,918 Pointsi think it might be warning();