JS.EventLoop
https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop
https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop
let doSmth = () => { return new Promise((resolve, reject) => { if (Math.random() > 0.5) { resolve(‘doSmth success’); } else { reject(‘doSmth Fail’); }
Sugar for promises
let doSmth = () => { return new Promise((resolve, reject) => { if (Math.random() > 0.5) { resolve(‘doSmth success’); } else {
let doSmth = () => { return new Promise((resolve, reject) => { if (Math.random() > 0.5) { resolve(‘doSmth success’); } else { reject(‘doSmthFail’); } })