async / await not working in combination with fetch
问题 I'm trying to use ES7 async / await together with fetch . I know I'm close but I can't get it to work. Here is the code: class Bar { async load() { let url = 'https://finance.yahoo.com/webservice/v1/symbols/goog/quote?format=json'; try { response = await fetch(url); return response.responseText; } catch (e) { return e.message; } } } which I use as follows: let bar = new Bar(); bar.load().then(function (val) { console.log(val); }); DEMO For some reason I always get into the catch with the