fetch api data in javascript using async await code example
Example: How to fetch data from an api async and await
async function fetchData() {
try {
const result = await axios.get("https://randomuser.me/api/")
console.log(result.data));
} catch (error) {
console.error(error);
}
}