title: Res.render array of arrays with express
body: <p>I want to res.render a web page with express using ejs template engine which has to display several infos about users.</p>
  
  <p>In this project I have :</p>
  
  <ul>
  <li><p>A group array named groupTab containing all de group names : var groupTab=["categ1", "categ2", "categ3"]</p></li>
  <li><p>An active directory connection using the npm package activedirectory which has the ability to get users from one group with the following method : getUsersForGroup.</p></li>
  </ul>
  
  <p>With the following code I can display all the users from each group :</p>
  
  <pre><code>for(var i = 0 ; i&lt;groupTab.length; i ++){
    ad.getUsersForGroup(groupTab[i], function(err,users){
      if(err) console.log(JSON.stringify(err);
      else{
        console.log(JSON.stringify(users); //This displays all the users that are in categ1            categ 2 and categ 3 on the console 
      }
    }
  }
  </code></pre>
  
  <p>The problem is that I'm not able to return this array client side and I'm completely stuck. I test some function with a callback to getUsersForGroup but I can't manage to print this array. </p>
  
  <p>What I want to do is something like that where afunction calls getUsersforGroup:</p>
  
  <pre><code>app.get('/', function(req,res){
      afunction(err,users){
        res.render('index.ejs',{users: users});
     }
  });
  </code></pre>
  
  <p>How can I do that ?</p>