Surprising value assignment due to operator precedence?
<p>I have this code (fiddle is too slow right now, sorry)</p>

<p>UPDATE: Sorry, I completely missed the boat here. </p>

<p>Here is the code I meant to write and it works without the ""</p>

<pre><code>$(function() {
  var x=0,y=1;
  var inputs = $("#div_id").find("input:text");
  var y = Math.ceil(inputs.size()/2);
  inputs.each(function (i, input)  {
    $(this).prop("value",(i % 2 == 0)?++x:++y);
  });
});  
</code></pre>

<hr>

<p>Original question based on completely wrong logic :O</p>

<pre><code>$(function() {
  var x=0,y=1;
  $("#div_id").find("input:text").each(function (i, input)  {
    $(this).val(""+(i % 2 == 0)?x++:y++);
  });
});  
</code></pre>

<p>If I remove the ""+ from the value, I get this wrong result</p>

<p><img src="http://i.stack.imgur.com/aH9Ag.png" alt="enter image description here"></p>

<p>instead of what I want, which is this:</p>

<p><img src="http://i.stack.imgur.com/bkjrz.png" alt="enter image description here"></p>

<p>Same if I use prop: </p>

<pre><code>    $(this).prop("value",""+(i % 2 == 0)?x++:y++);
</code></pre>

<p>Same if I prefix the ++</p>

<p>What am I overlooking? Is this an obvious thing?</p>
