Answers for "node js wait for foreach loop"

0

nodejs how to use await in foreach loop

async function printFiles () {
  const files = await getFilePaths();

  for (const file of files) {
    const contents = await fs.readFile(file, 'utf8');
    console.log(contents);
  }
}
Posted by: Guest on September-30-2020
-1

javascript wait foreach to finish

array.forEach(function(item){ 
    // Code
});
// Foreach Ended
alert("Foreach Finish!");
Posted by: Guest on August-14-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language