bhylu.com

Advertisements

JS 2017

Async functions return promises and allow await inside their bodies. Object.entries also makes record iteration convenient.

Where to run this

This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.

A practical example

JavaScript

async function label() { return "Repair club"; }
console.log(await label());
console.log(Object.entries({places: 12}));

What happens

The resolved text and the property pair are printed.