an instruction is executed before the one above in nodejs duplicate

It’s because https.get is asynchronous, so NodeJs don’t wait this call and immediately executes console.log('message2');. That way we can not to wait async call completion and continue doing something. After that request finished successfully you’ll get console.log('message');

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top