Easy question. Just an explict look:
 var token = "12345"
function einloggen(){
    var test = particle.login({username: userName, password: passWord});
    test.then(
    function (data) {
            token = data.body.access_token;
            console.log('tokenoutprint1:', token);
            },
    function (err) {
            console.log('LoggingIn Failed', err);
            }
);
console.log('tokenoutprint2:', token);
}
einloggen();
after that i want to reuse the "new" token in a different Function...
callFunctionAVC(token);
The third last line will print me 12345. But I want print out the "new" token, defined in. Like in "normal" java 
I don't know why because the first console.log shows me the right token.
SO HOW DO I GET THE "TOKEN" TO A GLOBAL VARIABLE. Thats my "real" Question. Please send full codes only otherwise i won't get it.
Sorry for not being a pro, I'm just learning in school.
Greetings.
 
    