Asynchronous access to an array in Firebase

Here is my code:
var userRef = new Firebase("https://awesome.firebaseio.com/users/");

var tokenRef = userRef.child(key+'/tokens');
tokenRef
.once('value', function(snapshot){

var userTokenSync = $firebase(tokenRef);
var userTokens = userTokenSync.$asArray();


console
.log(userTokens);
console
.log(userTokens[0]);

for(var i=0, len = userTokens.length; i < len; i++) {
console
.log(userTokens[i]);
}
console
.log('done');
})
This code gets the tokens of a user from firebase, and I just want to browse the tokens array.
Here is what the console gives me:
enter image description here
As you can see, I cannot access the array. Do you have any idea of how I could do this?
Thanks in advance.

Comments

Popular posts from this blog

App Store Connect ITMS-90078: Missing Push Notification Entitlement - Your app appears to register with the Apple Push Notification service, but the app signature's entitlements do not include the "aps-environment"

RGPV CSE 8th Semester Soft computing Notes and Lectures

Facts about bb ki vines bhuvan bam