josephtan / xhrfunction

simple xhr function for whiteboard interviews

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

xhrfunction

Xhr function for whiteboard interviews, its also applicable for real projects that's build on functional programming.


Question


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?

Notes

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.

About

simple xhr function for whiteboard interviews


Languages

Language:JavaScript 85.2%Language:HTML 14.8%