How to store fetch response in javascript variable - Stack Overflow | thiscodeWorks

PHOTO EMBED

Sat Jun 04 2022 16:53:25 GMT+0000 (Coordinated Universal Time)

Saved by @Kira_Tsugikuni ##fetch ##javascript

async function fun() {
  return fetch('https://jsonplaceholder.typicode.com/todos/1').then(res => res.json());
}
 
const data  = await fun();
content_copyCOPY

https://www.thiscodeworks.com/how-to-store-fetch-response-in-javascript-variable-stack-overflow-javascript/620410f1c6efb50015062db1