title: Jquery each - do index values always start at 0?
body: <p>I have a spurious problem which seems to indicate the index value got from the jquery each method does not always start at 0.</p>
  
  <p>My javascript looks a bit like this: </p>
  
  <pre><code>$("#mylist").each(function(index) {
      var obj = new myclass();
      obj.property = "whatever";
      obj.sequence = index + 1;
      parentobj.list.push(obj);
  });
  </code></pre>
  
  <p>This all gets packaged into json and ajaxed (please pardon verb usage) back to the server. The server then deserialises the json into .net objects. It's at this point I get an error:</p>
  
  <pre>The value '91111' cannot be parsed as the type 'Int16'. </pre>
  
  <p>This is at the point it tries to push the sequence value into a short field. </p>
  
  <p>I cannot recreate this (always happens to other users). I may be able to add some debug code to the javascript files in question during a quiet period but there's no guarantee it will happen then. </p>
  
  <p>There also seems to be a strange pattern to the values. The values in the log are:
  61111, 81111, 91111, 111111, 211111, 311111. These neither ascend or descend and sometimes repeat.</p>
  
  <p>Can anyone shed a light on this or confirm that I cannot trust the index to start from zero?</p>
  
  <p>Thanks</p>