Skip to content

Instantly share code, notes, and snippets.

View jportella93's full-sized avatar
🌶️

Jon Portella jportella93

🌶️
View GitHub Profile
@jportella93
jportella93 / async.js
Last active July 25, 2018 22:16 — forked from arol/async.js
Asynchronicity exercise
// log the `rnd` result in the console using all three async techniques.
// You can only call console.log inside the `main` function.
const randomNumber = () => {
return Math.random();
}
// 1. Make it wait for 1 sec. with `setTimeout` and log it on main function
const timeoutRandomNumber = (func, cb) => {
return setTimeout(() => func(), 1000)