js await to async code example
Example 1: async await
const data = async () => {
const got = await fetch('https://jsonplaceholder.typicode.com/todos/1');
console.log(await got.json())
}
data();
Example 2: async await javascript
myFunction().then(
function(value) { /* code if successful */ },
function(error) { /* code if some error */ }
);