how to use await to console

Solutions on MaxInterview for how to use await to console by the best coders in the world

showing results for - "how to use await to console"
Augustine
04 Sep 2018
1function resolveAfter2Seconds(x) {
2  return new Promise(resolve => {
3    setTimeout(() => {
4      resolve(x);
5    }, 2000);
6  });
7}
8
9async function f1() {
10  var x = await resolveAfter2Seconds(10);
11  console.log(x); // 10
12}
13
14f1();
15