@@ -993,7 +993,7 @@ var value = generator.next();
993
993
> console .log (value); // { value: 4, done: false }
994
994
```
995
995
996
- Where the [ next] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator/next )
996
+ Where [ next] ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator/next )
997
997
will allow us to push our generator forward and evaluate a new expression. While the above example is extremely
998
998
contrived, we can utilize Generators to write asynchronous code in a synchronous manner:
999
999
@@ -1065,6 +1065,8 @@ and Promises allow us to write asynchronous code in a synchronous manner while r
1065
1065
errors in a nice way, we can actually begin to utilize a simpler construction that provides the same benefits:
1066
1066
[ async-await] ( https://github.com/DrkSephy/es6-cheatsheet#async-await ) .
1067
1067
1068
+ <sup >[ (back to table of contents)] ( #table-of-contents ) </sup >
1069
+
1068
1070
## Async Await
1069
1071
1070
1072
While this is actually an upcoming ES2016 feature, ` async await ` allows us to perform the same thing we accomplished
@@ -1089,5 +1091,7 @@ async function main() {
1089
1091
main ();
1090
1092
```
1091
1093
1092
- Under the hood, it performs similarly to Generators. I highly recommend giving it a try, A great resource
1093
- for getting up and running with ES7 and Babel can be found [ here] ( http://masnun.com/2015/11/11/using-es7-asyncawait-today-with-babel.html ) .
1094
+ Under the hood, it performs similarly to Generators. I highly recommend using them over Generators + Promises. A great resource
1095
+ for getting up and running with ES7 and Babel can be found [ here] ( http://masnun.com/2015/11/11/using-es7-asyncawait-today-with-babel.html ) .
1096
+
1097
+ <sup >[ (back to table of contents)] ( #table-of-contents ) </sup >
0 commit comments