How to call a variable in another function?

Former Member
Former Member

How to call a variable in another function in same class?

var temperature;
var toTemperature;

function onUpdate(dc) {
    dc.drawBitmap(38, 65, Ui.loadResource( Rez.Drawables.cloud_icon ));
    dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_GREEN);
    dc.drawText(50, 85, Graphics.FONT_XTINY, toTemperature+"°", Graphics.TEXT_JUSTIFY_CENTER);
}

function onTemperature(ie) {
    temperature = ie[0]["current"]["temperature"];
    toTemperature = temperature.toString();
}

because toTemperature still null