Skip to content

Instantly share code, notes, and snippets.

View RafaelC457ro's full-sized avatar

Rafael Castro RafaelC457ro

  • Brazil
View GitHub Profile
@RafaelC457ro
RafaelC457ro / user.js
Last active July 21, 2020 15:30 — forked from EtienneR/user.js
XMLHttpRequest RESTful (GET, POST, PUT, DELETE)
// Get all users
var url = 'https://reqres.in/api/users';
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.onload = function () {
var users = JSON.parse(xhr.responseText);
if (xhr.readyState == 4 && xhr.status == '200') {
console.table(users);
} else {
console.error(users);
@RafaelC457ro
RafaelC457ro / event-loop.md
Created March 25, 2018 17:12 — forked from jesstelford/event-loop.md
What is the JS Event Loop and Call Stack?

Regular Event Loop

This shows the execution order given JavaScript's Call Stack, Event Loop, and any asynchronous APIs provided in the JS execution environment (in this example; Web APIs in a Browser environment)


Given the code