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!

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 trial

JavaScript JavaScript Basics (Retired) Creating Reusable Code with Functions Review Creating Reusable Code with Functions

creating reusable codes with functions

Given this function, write the code to call it:

function warning() { alert('Warning, warning, warning!'); }

i think it might be warning();

4 Answers

Christian Linnerud
Christian Linnerud
7,312 Points

Type this and you will pass this question.


The semi colon ; is already typed into the questions.

Thanks, very helpful


To call the function simply write the name of the function followed by brackets and semi colon...

//name of function alertRandom
function alertRandom() {
  var randomNumber = Math.floor( Math.random() * 6 ) + 1; 

//call function alertRandom

Hope this helps!


Jonathan Dalby
Jonathan Dalby
8,528 Points

How annoying, this was driving me nuts !!!! All about attention to detail I guess, dammit!