title: How to pass a integer into a javascript function?
body: <p>I am getting a response from ajax request(done by jquery). </p>
  
  <p>I have a method that displays errors to the users. Sometimes though I have some other information coming along with the json request.</p>
  
  <p>So I don't want this info shown(where the rest of the errors are). So I figured since I always know the length of the json coming back I can just shorten the length since the error method just uses a while loop so if it is one less then it won't display that json part.</p>
  
  <p>So I did this</p>
  
  <pre><code>var length = result.length -1;
  
  ErrorsMethod(result, length); // call function.
  
     function ErrorsMethod(result, length)
      {
         while( i &lt; length)
         { 
           // do stuff.
         }
      }
  </code></pre>
  
  <p>length is always undefined when it gets passed in though. I don't understand why.</p>
  
  <p>I then tried</p>
  
  <p>length.length
  ParseInt(length);</p>
  
  <p>None seems to work. I don't even know what I am working with. When I do an alert of "length" var before it goes into the function it spits out a number.</p>