stream.getTracks().forEach(track => track.stop())
const root = 'https://jsonplaceholder.typicode.com';
const func1 = function() {
return fetch(root + '/posts/2').then(response => {
if (response.status === 200) {
return response.json();
} else {
throw new Error("API error")
}
}).then((json) => {
console.log("2",json);
json.fetched = new Date();
return json;
})
}
const func2 = async function() {
let q = await func1();
console.log("1", q)
return q;
}
func2();