Skip to content

Commit

Permalink
Create final demo on async await
Browse files Browse the repository at this point in the history
  • Loading branch information
mattry committed Dec 11, 2024
1 parent 7ee35c1 commit dfd0130
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions week1/day3/asyncdemo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const getTodos = async () => {
const response = await fetch("https://jsonplaceholder.typicode.com/todos/1");
const data = await response.json();
return data;
}

console.log(1);
console.log(2);

getTodos().then((data)=>{
console.log(data);
}).catch((error)=>{
console.log(error);
});

console.log(3);
console.log(4);
console.log(5);

0 comments on commit dfd0130

Please sign in to comment.