Async function happening before another async function is done in Node.js

Now I realy don't know about async/await in node.js to be honest but I'm stuck :(

this is my code

async function main(){
    var pokemonID = getRandomPokemon();

        .then(data => {getPokemonInfo(data)})
        const tempData = require('./temp_data.json');
        await down.load(tempData.pokemonImg)
        var tweetText = "Today's Pokemon of the day is " + tempData.pokemonName + ", which is a " + tempData.pokemonType + " type pokemon"
        await tweet.tweeter(tweetText)



I don't get an error but the second async function executes before the first one.

Read more here:

Content Attribution

This content was originally published by B R U H at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: