Butanic

u/Butanic


r/learnjavascriptβ€’

I just started with JavaScript and I'm horrible with promises.

I have a function, let's call it doStuff, that makes a query to a database. I want it to return the results of the query (we'll call them result.data) to the function that called it.

function doStuff(){

let x = "";

session .run( //query parameters) .then(result => {

alert(result.data); // This properly logs the result data

x = result.data;

}) .catch(//error catching function);

return x;

}

The issue I have is that the function finishes executing and returns null before the result is processed.

Later in the execution I get an alert with the correct result data displayed, so it's not an issue with the database.

I wan

32

r/neoliberalβ€’

Joe's online game is admittedly kinda weak. Winning the presidency is going to require a stronger online presence to counter the Trump-stans and the Bernie Bros. We can all help by doing a little bit every day on social media. Thoughts?

And if you hate malarkey as much as I do, help πŸ’ŽπŸŠπŸ’Žour boy πŸ’ŽπŸŠπŸ’Ž and join us at r/JoeBiden

25944





r/UCalgaryβ€’

Left my Helly Hansen rain jacket somewhere in Engg or ST, and I need it this weekend. Shoot me a DM if you saw it or know where it is. Peter Tracey bless πŸ™

145