Since fetch() is an async function that returns a javascript promise, need to use await keyword, that is now supported by Chrome dev tools console.
await fetch('https://jsonplaceholder.typicode.com/posts').then(r => r.json())and to make result data nicely formatted as a table:
await fetch('https://jsonplaceholder.typicode.com/posts').then(r => r.json()).then(console.table)
No comments:
Post a Comment