0

Hello to all forum members. I'm pretty new in terms of node js,What I want to do is execute commands synchronously

A simple example:this is my code below.

var arr=fun_test(){blah blah blah}
console.log(arr);

What actually happens is that I do the second command before the first one, I will be happy for any help.

  • It will depend on the specific modules and operations you're trying to use. While some, especially Node.js' own code modules, offer synchronous versions for I/O operations, it is typical for packages to offer only asynchronous I/O. So, getting used to it and being familiar with options for managing it will be a necessary skill to have with Node.js. A good summary of common options can be found in the answers to "[How do I return the response from an asynchronous call?](https://stackoverflow.com/questions/14220321/how-do-i-return-the-response-from-an-asynchronous-call)" – Jonathan Lonowski Sep 03 '18 at 20:11
  • Also [How can I wait for set of asynchronous callback functions?](https://stackoverflow.com/questions/10004112/how-can-i-wait-for-set-of-asynchronous-callback-functions) – Jonathan Lonowski Sep 03 '18 at 20:13
  • can you show me example of how could i Wait until function is finished then console.log with out set time limit. – חי וקנין Sep 03 '18 at 20:39

0 Answers0