title: how to use for each with mustache javascript?
body: <p>i have some json objects and some of them have some other objects inside them.</p>
  
  <p>if i leave only the json obj that don't have other obj inside them and then apply the template, everything goes well, i get, in this case 3 li elements.</p>
  
  <p>but if i grab the original json obj the results are a bit wired. I believe i need to do a <code>each</code> statement to iterate through each sub json obj from inside each main one</p>
  
  <p>maybe i am a bit confuse so here is some code.</p>
  
  <p>i have some json data like this:</p>
  
  <pre><code>{
  "msg_id":"134",
  "message":"Nick",
  "comment":[
      {
      "com_id":"9",
      "comment":"test",
      },
      {
      "com_id":"10",
      "comment":"testtt",
      },
      {
      "com_id":"11",
      "comment":"testtttt",
      }]
  },
  {
  "msg_id":"134",
  "message":"Nick",
  },
  {
  "msg_id":"134",
  "message":"Nick",
  }
  </code></pre>
  
  <p>and i am trying to arive at something like this:
  
  
      
          Nick
          <p>test</p>
          <p>testtt</p>
          <p>testtttt</p>
      
      Nick
      Nick
  </li>
  </p>
  
  <p>i've created a template like this:</p>
  
  <pre><code>function messagesTamplate(data)
  {
      $.each(data, function(index, obj)
      {
          msg += template.replace( /{{message}}/ig , obj.message );
          if(obj.comment) {
              $.each(obj.comment, function(key, val)
              {
                 msg += template.replace( /{{comment}}/ig , val.comment );      
              });
          }
  
      });
  
      return msg;
  }
  </code></pre>
  
  <p>then i just append this to the main ul. </p>
  
  <p>thanks</p>