async function myFetch() {
try {
/* Request */
let res = await fetch('https://reqres.in/api/users/2');
/* Check response */
let resChecked;
if (res.ok) { /* If successful: */
console.log("Request successful");
resChecked = res;
let data = await resChecked.json();
console.log(data);
} else { /* If unsuccessful: */
console.log("Request unsuccessful");
}
} catch (err) {
console.log(err);
}
}
myFetch() // Prints data object containing information about user 2