I'm just recapping some basic javascript any idea where i am going wrong?, i want to receive the response and place it into an array inside the function. The below is what i have tried.
// simple api request
function abs() {
var a = []
fetch('https://jsonplaceholder.typicode.com/todos/1')
.then(res => {return res.json()})
.then(data => a.push(data))
console.log(a)
}
abs()
Thanks in advance