Javascript "do-while" type loop
<p>I'm working with some JS code that I inherited on a project, and in several instances it has loops set up like this one:</p>

<pre><code>while(text = someBufferObject.read()) {
  //do stuff with text
}
</code></pre>

<p>I'm assuming this is to achieve some sort of do-while type functionality. However, when I run this through JSLINT it complains that it "Expected a conditional expression and instead saw an assignment."</p>

<p>Is there a more accepted approach that I should use for these loops? I'm not sure if something like below is the best way or not:</p>

<pre><code>text = someBufferObject.read()
while(text) {
  //do stuff with text
  text = someBufferObject.read()
}
</code></pre>
