i am new to nodejs,i wrote a function like this:
function getResult(){
    var result='';
    //do something asynchronous,like query datebase and assign result
    db.query(sql,function(err,res){
        if(err) throw err;
        result=res;
    })
    return result;
}
i run it
getResult();
but i can't get result. it seems to be the function return before the asynchronous steps .
can i waiting for the asynchronous steps done,and then let the function return ?how? thanks..
 
     
    