title: Finding last iteration in for in loop javascript
body: <p>I am having following sample code </p>
  
  <pre><code>   var obj = { a: {b:1, c:3 }, d :{f:5}}
          var string = "";
          for(var key in obj){
              for(var subkey in obj[key]){
               string += subkey + "="+ obj[key][subkey] + "&amp;";
               //for last iteration "&amp;" should not be added.
           }
      }
     console.log(string);
  </code></pre>
  
  <p><strong>output is</strong> </p>
  
  <pre><code>b=1&amp;c=3&amp;f=5&amp; 
  </code></pre>
  
  <p><strong>Required Output</strong> </p>
  
  <pre><code>b=1&amp;c=3&amp;f=5
  </code></pre>