代码示例:(标识:js_async)
<!DOCTYPE html>
<html>
<body>

<h1>JavaScript async / await</h1>

<p id="demo"></p>

<script>
function myDisplayer(some) {
  document.getElementById("demo").innerHTML = some;
}

async function myFunction() {return "Hello";}

myFunction().then(
  function(value) {myDisplayer(value);},
  function(error) {myDisplayer(error);}
);</script>

</body>
</html>
运行结果: