title: How to make 0 return true?
body: <p>I have a situation where I am searching for something in an array, and if a value is found, I do something. I am doing this by setting a variable to undefined, and then when the value is found, setting to the index of the element found. This would work if the value returned is anything but 0, but if it is 0, then it returns as false. How can I work around this?</p>
  
  <pre><code>var index = undefined;
  for(var i=0; i&lt;ARRAY; i++)
  {
    if(CONDITION)
       index = i;
  }
  if(index)
  {
    DO SOMETHING
  }
  </code></pre>
  
  <p>So my problem occurred when the index turned out to be zero, because this returned false. The reason I want to do it this way is because I am not sure if it exists in the array or not.</p>