Proper Promises Example
by jamesbrndwgn
JavaScript
function getCall () {
return new Promise((res, rej) => setTimeout(() => res('success'), 2000))
}
function doSomething () {
console.log('do something else')
}
getCall()
.then(res => console.log(res))
.then(doSomething)
.then(() => console.log('done'))