These snippets show several different ways of accomplishing the same asynchronous task: fetching a document and reporting the status code.
- Using callbacks.
- Using ES2015 Promises directly.
- Using ES7 Async/Await, which is just syntactic sugar for Promises.
The third example is the future, and will likely start landing in runtimes soon. You can use it today thanks to Babel, as snippets #4 and #5 show.