XHR GET Requests

Hi people!
I have a doubt.

Why in this case we don’t use the variable ‘xhr’ instead of XMLHttpRequest to check the DONE state, i mean:

if (xhr.readyState === xhr.DONE) {

instead of:

const xhr = new XMLHttpRequest();

if (xhr.readyState === XMLHttpRequest.DONE) {
  return xhr.response;

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.