title: Reverse String In Place Using for loop in JavaScript
body: <p>var n = "reversestrings", k=3;</p>
  
  <p>want to reverse string in chunk of 'k',</p>
  
  <p><strong>Answer would be : ver sre tse nir gs;</strong></p>
  
  <p>if Last word less then 'k' then don't need to reverse.</p>
  
  <p>I am using below code but not getting expected answer.</p>
  
  <pre><code>var n = 'stringreverses', k = 3, str = '', s = '';
      var c = 0;
      for( var i=0; i&lt;n.length; i++ ){
          if( c&lt;k ){
              c++
              str += n[i];
              s=str.split('').reverse().join('');
          }
          else{
              console.log("-" + s);
              c=0;
          }
      }
  </code></pre>