AJAX Requests - Why .open() and .send() always at the end of the code block?

Hey there,
I’m wondering: is there a specific reason why xhr.open() and xhr.send() are defined at the end of the AJAX Request code block?
I see this choice in the XHR Diagram and throughout the Requests chapter of Introduction to JS course.

Is just a coincidence or is that best practice?


I’ll be more specific on why I am asking.
Logically to me makes more sense to put the xhr.open() and xhr.send() just below the variables definition, as I understand it is also the synchronous way JS is executing. So in order.
Meanwhile the block to handle the response comes after the request has been sent and waits for it to be done.

However, maybe is there a technical reason why .open() and .send() are at the bottom which I haven’t thought of?