Javascript for loop with if statement not reaching the else if statement : <p>why wont this reach the else if and return (i + 0) / 2? Also, why wont the alert give me i + 0 for a 2 digit value? (ie: 10, 20, 30, 40, etc.  Any help would be appreciated.</p>

<pre><code>var key= "OSN0MSA9991UNAAM8ELDPBD9F57BD6PU6BVBN54CDLEGDSUSNS";
var x = 0;
if (key[20] != "P" || key[18] != "P") {
 x = 0;
 for (i=0;i&lt;10;i++) {
  if (key[26] == i) {
   x = i + 0;
   alert(x);
  }
 };
} else if (key[20] == "P") {
 for (i=9;i&gt;-1;i--) {
  if (key[26] == i) {
    x = (i + 0) / 2;
   alert(x);
  }
 };     
};
</code></pre>
