balance.js
var CoinStack = require('coinstack-sdk-js')
var accessKey = 'c7dbfacbdf1510889b38c01b8440b1';
var secretKey = '10e88e9904f29c98356fd2d12b26de';
var client = new CoinStack(accessKey, secretKey);
client.getBalance(address, function(err, balance) {
console.log('balance', balance)
});
I have a this code, then i want to get var balance out of function
i don't know what to do, i want fixed code
i need your helps
balanceis in your callback or in a function you call from the callback. That's how async code works in Javascript. Get used to it, design your code to work that way, stop looking for a way around it. Any code that needsbalanceshould be in your callback or in a function that you call from the callback and you pass thebalanceto it.