Conclusion:
This example uses the XMLHttpRequest interface to initiate an http request from a remote server.
Check out
the javascript (with comments) to see more details.
I've always used request libraries in my apps that wrap these APIs, like
fetch
or Jquery's ajax. It was a useful exercise to see how to initiate requests without other libraries around to help!
Try throttling your network to see the request proceed more slowly through its stages.