1//you can only return a value from an async function by passing in a callback function like so:
2function longRunningFunction(param1, callback){
3 setTimeout(function(){
4 var results="O High there!";
5 callback(results);
6 }, 2000);
7}
8
9//then call the async function and pass the callback function like so
10longRunningFunction("morning", function(result){
11 alert(result);
12});