
04
A Promise
works well with async code, or data not yet recieved, **Note
you can call the function getWeather
directly when it returns a promise, and
we can pass other functions
into then and the argument is automatically passed in
function getWeather() { return new Promise(function (resolve, reject) { console.log('...waiting') setTimeout(() => { resolve('Cloudy') }, 90) }) } function weatherSymbols(weather) { if (weather == 'Cloudy') { console.log('☁️') } } getWeather().then(checkWeather)
03
console.log('1')
Promise()
Takes two functions as arguments,
resolve()
, and reject()
function getWeather(){ return new Promise(function(resolve, reject )) }
04
TBD()
TBD()
TBD