One array that I am dealing with consists of the following:
[ Ref(Collection("twitch_users"), "280881231730573837") ]
My goal is to extract the string of numbers from this array and utilize it in another function within my codebase. However, I am facing a challenge as I usually access elements by name like data.info[0]
, but in this case, the object lacks a specific name. I am at a loss on how to achieve this without a designated name.
Reproducing this scenario may prove to be complex since the data is fetched from an external database. Nevertheless, I will make every effort to furnish all pertinent details.
// The initial two lines yield
// [ Ref(Collection("twitch_users"), "280881231730573837") ]
// Please note that Ref() originates from the FaunaDB API and is not a custom function in my code
var queryuserInfo = fauna.paginate(q.Match(q.Index("users.allInfo"), tags.username));
queryuserInfo.each(function (page) { userInfo = page });
Subsequently, I output the result using console.log:
console.log(userInfo[0])