This is my following code I'm unable to get the 'check'variable value can you find the issue where I made mistake :-)
checkUsr = function() {
  var q1 = "select * from Mytable where id='123';";
  var check= null;
  con.query(q1, function(error, rows, fields) {
    if(error) {     
        console.info('11111111');
        check={
            "response":"error", 
            "responseString": JSON.stringify(error)
        };
        // return check;        
    } else {
        console.info('222222222');
        if(rows.length>0){
            check = {
                "response":"error", 
                "responseString": "already sent"
            };      
            // return check;
        }else{
        console.info('33333333');
            check= {
                "response":"success",
                "responseString":"go ahead..!!"
            };
            // return check;
        }
    }
    return check;
  });
  return check;
}
checkUsr(); 
expected value the value of check object inside the if/else block
But output
 
    