FAQ: Requests I - HTTP Requests

This community-built FAQ covers the “HTTP Requests” exercise from the lesson “Requests I”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Introduction To JavaScript

FAQs on the exercise HTTP Requests

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Hello For this one, i thought only the line within the setTimeout would be delayed? But actually all three lines are delayed, why is that? Thanks!

5 Likes

Is AJAX a built-in feature of JavaScript? Is AJAX used only for requests or does it have other applications?

Why does the console.log statement within the setTimeout function still occur last, even after you change the timeout to 0?

`console.log('First message!');
setTimeout(() => {
   console.log('This message will always run last...');
}, 0);
console.log('Second message!');`
8 Likes

cthunda303. Once you use setTimeout(), in pratice you can hardly ever have 0 milliseconds. Due to admin reasons the time is always approximate, so 0 does not really mean zero precisely.

4 Likes

Thanks,I didn’t know that.

Because of the event loop. The seTimeout got assigned to a seperate queue.

1 Like