Code-Fellows reading notes.
const superagent = require('superagent');
function getCharacters() {
superagent.get('https://swapi.dev/api/people/70')
.then(data => {
console.log({
[data.body.name] : data.body.url
});
})
.catch(err => {
console.error(err);
})
}
getCharacters();
const superagent = require('superagent`);
async function getCityInfo(city) {
try {
let cityResults = await superagent.get(`https://geocode.xyz/${city}?json=1`);
// console.log(cityResults.body);
console.log(`The latitude and longitude for ${city} is: ${cityResults.body.latt} and ${cityResults.body.longt}, respectively.`)
} catch(error) {
console.log('error from inside getCityInfo')
}
}
getCityInfo('seattle');
It basically tells us that we are going to clear it from the stack but once the code is done running we will get the return value, this just opens up the stack ?
not by default, it is passed as an argument until it is executed.