title: Why is my while loop stucked?
body: <p>I want to replace two (or more) line breaks in a textarea but Its always got stucked in an infinty loop</p>
  
  <p>here it is:</p>
  
  <pre><code>var dateinput = document.getElementById("date");
  var intIndexOfMatch = dateinput.value.indexOf('\n\n');
  
  
  while (intIndexOfMatch != -1){
      dateinput .value = dateinput .value.replace('\n\n', '\n');
  
  }
  </code></pre>