I have the following code
binance.prices('BNBBTC', (error, ticker) => {
    priceNow = ticker.BNBBTC;
    console.log(priceNow)
  });
But I need to use the variable "priceNow" outside of that function, I have tried many things, for example:
 var priceNow = ""
  binance.prices('BNBBTC', (error, ticker) => {
    priceNow = ticker.BNBBTC;
    // console.log(priceNow)
  });
  console.log(priceNow) //But this just say nothing
But this doesn't work, I can't update the global variable from the function, why does this happen? and because if it works in example like this:
var a = 10;
myFunction();
function myFunction(){
   a = 20;
}
console.log("Value of 'a' outside the function " + a); //outputs 20
