0

I have a function

exports.myfunction = function(){
connection.open(function (error, client) {
connection.authenticate(user, pass, function (err, val) {
                if (err) {
                return 0;                  
                } else {
                  return 1;

                }
   } 
  }
 }

and in another file I want to see the output of this function 0/1. How I can pass this value to the parent function?

1 Answer 1

1
exports.myfunction = function(callback){
connection.open(function (error, client) {
connection.authenticate(user, pass, function (err, val) {
                if (err) {
                  callback(0);                  
                } else {
                  callback(1);

                }
   } 
  }
 }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.