async
/ await
can be used in conjunction with promises to make asynchronous code act in a synchronous manner.
The following pattern is considered a warning:
function getSomeData() {
return fetch('http://some.url/')
}
getSomeData().then(response => {
console.log(response);
});
The following pattern is not considered a warning:
async function getSomeData() {
return fetch('http://some.url/')
}
const responst = await getSomeData()
console.log(response);