Given the fact that you're passing a callback function to the
query
function, it's safe to assume that it's running asynchronously. The data won't be available until the callback function is called.
You'll either need to rewrite your code to use the data inside the callback, or find a way to make the code
async
using
a promise[
^].