async function getTodos() {
const res = await fetch("https://jsonplaceholder.typicode.com/todos");
const data = await res.json();
console.log(data);
return data;
}
const todos = await getTodos();
Last line should also have await if not, the console.log in later gets executed first