title: Wait for function ends inside another function in Javascript
body: <p>I´m sure that this is a easy issue, but i don't know how i can solve it.</p>
  
  <p>I have two functions and an object in javascript (nodejs) like this:</p>
  
  <pre><code>var auxmap = new Map();
    function one(){
     for(var i...){
       //init map and do something
       two(i,params);
     }
  
   }
    function two(i,params){
       //create array from params called auxarray
     map(i) = auxarray
   }
  </code></pre>
  
  <p>my question is if i can do that function one wait until function two finish it execution, like in a C# program and how i can do that.</p>