async/await lets an async function pause for an asynchronous result without blocking the JavaScript engine. The async keyword marks the function; await marks each task whose result it needs. Promises and generators provide the underlying model, without requiring you to write their coordination boilerplate. section 6.4.1 section 6.4
(async function (){
try {
const ninjas = await getJSON("data/ninjas.json");
const missions = await getJSON(missions[0].missionsUrl);
console.log(missions);
}
catch(e) {
console.log("Error: ", e);
}
})()
!@%STYLE%@!
{"css":"{\"css\": \"font-weight: bold;\"}","target":"[[{\"line\":0,\"ch\":1},{\"line\":0,\"ch\":6}],[{\"line\":2,\"ch\":19},{\"line\":2,\"ch\":24}],[{\"line\":3,\"ch\":21},{\"line\":3,\"ch\":26}],[{\"line\":2,\"ch\":19},{\"line\":2,\"ch\":24}],[{\"line\":3,\"ch\":21},{\"line\":3,\"ch\":26}]]"}
!@%STYLE%@!
This example awaits JSON requests in sequence and handles errors with try/catch. section 6.4.1
















