title: JS function to count odd numbers and negatives in array
body: <p>I'm  currently trying to write a JS function that takes multiple arguments to count or tally the odd numbers and negative numbers in an "array". I put array in quotes because the function actually takes in arguments.</p>
  
  <p>I want to use a for loop to get the odds and negatives, but my code isn't working. </p>
  
  <pre><code>function arrayAnalyzer() {
  
  var myArray = Array.prototype.slice.call(arguments)
  
  var counter = {
    odds : 0,
    negatives : 0,
    avg : 0,
    median : 0
  }
  
    for(var i = 0; i &lt; myArray.length; i++) {
  
      if(myArray{i] % 2 === 1) {
         counter.odds++ }
  
      if(myArray[i] &lt; 0) {
         counter.negatives++ }
      }  
  
  return counter
  }
  
   arrayAnalyzer(7, -3, 0, 12, 44, -5, 3);
  </code></pre>
  
  <p>I've found online that this code works, but I want to use a for-loop if possible.</p>
  
  <pre><code>myArray.forEach(function(num){
      if (Math.abs(num) % 2 === 1) counter.odds++
      if (num &lt; 0) counter.negatives++
  })
  </code></pre>