Promise

Sample Script for Executing with Synchronous Process using Node.js

Gists This is a sample script for executing with the synchronous process using Node.js. Sample script function work(e) { return new Promise((resolve, reject) => { setTimeout(() => { console.log(e); resolve("ok" + e); }, 1000); }); } async function main() { var ar = [1, 2, 3, 4, 5]; for (var i = 0; i < ar.length; i++) { console.log('start' + ar[i]); await work(ar[i]).