diff --git a/Javascript/program-13/program.js b/Javascript/program-13/program.js new file mode 100644 index 00000000..ff4f9d79 --- /dev/null +++ b/Javascript/program-13/program.js @@ -0,0 +1,17 @@ +`Asyncronous function +async function executes after the main thread is done with execution` + +console.log("first"); + +async function fun() { + let promise = new Promise((resolve, reject) => { + setTimeout(() => resolve("Executed this!"), 2000); + }); + + let result = await promise; + console.log(result); +}; + +fun(); + +console.log("first");