function foo() {
return fetch('https://central.wordcamp.org/wp-json/wp/v2/wordcamps');
}
function* main() {
try {
var text = yield foo();
var d = text.json();
console.log(d); //Promise {<pending>}
} catch (err) {
console.error(err);
}
}
var it = main();
var p = it.next().value;
// wait for the `p` promise to resolve
p.then(function (text) {
it.next(text);
},
function (err) {
it.throw(err);
}
);
promise result ok but in console Promise {<pending>}
SCREEN SHOT Anybody can help me where the problem. BOOK REFERNCE
you can check helping detail in this book search Generators + Promises.