How can this code be executed without co?

var co = require("co");
var fetch = require("node-fetch");

function* gen () {
  let url = "https://api.github.com/users/github";
  let result = yield fetch(url);
  let json = yield result.json();
  console.log(json);
}

co(gen);

do not use the co library, do not change the gen function, how to execute the gen function with native generator?

Mar.13,2021

Found in
  ES asynchronous task encapsulation . 

Menu