async/await
by Artem
JavaScript
'use strict';
function doRequest(url) {
return fetch(url).then(res => res.json());
}
async function test() {
let res = await doRequest('https://httpbin.org/ip');
console.log(res);
}
test();
by Artem
'use strict';
function doRequest(url) {
return fetch(url).then(res => res.json());
}
async function test() {
let res = await doRequest('https://httpbin.org/ip');
console.log(res);
}
test();