title: IndexOf in a function
body: <p>How can I return the index position of <code>"needle"</code> in this array? </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function findNeedle(haystack) {
    return findNeedle.indexOf('needle');
  }
  
  findNeedle(['3', '123124234', undefined, 'needle', 'world', 'hay', 2, '3', true, false]);</code></pre>
  </div>
  </div>
  </p>