1function firstFunction(_callback){
2 // do some asynchronous work
3 // and when the asynchronous stuff is complete
4 _callback();
5}
6
7function secondFunction(){
8 // call first function and pass in a callback function which
9 // first function runs when it has completed
10 firstFunction(function() {
11 console.log('huzzah, I\'m done!');
12 });
13}