You may call function from any other place into your JavaScript code. After the function is executed, the control goes back to other script which called it.
alert('Example 1: the House');
example(1,'house');
(write more code)
Thus this script first generates an alert box, then calls the function & after the function is finished it continues to execute the rest of instructions in the calling code.