我想在节点中的另一个函数中访问值,但我得到结果未定义?

时间:2017-08-02 03:50:01

标签: javascript node.js

如何在任何变量旁边加速?

if

1 个答案:

答案 0 :(得分:-1)

var rates = require('./rate.js');

rates.fromBTC(1, currency, function (response) {     
        console.log(response) //you will get rate here
})

//in rate.js file
exports.fromBTC = function(num,currency,callback){
  /*
  do some operation to find rate
  */
  return callback
}