Xhr function for whiteboard interviews, its also applicable for real projects that's build on functional programming.
How do you request a HTTP json api from a server and tell it to send a response and send a message to the user if there is an error or no response if the request takes 5 seconds or more?
The question in particular examines the individual ability to recall the complete cycle of xhr methods for Web API request. Candidates can get stumped during the whiteboard session if they cannot recal the complete cycle. The sample code xhr function is built to be reusable to multiple scopes within a javascript file.