title: Hackerrank: Plus Minus
body: <p>I'm trying to find the fraction of positive, negative, and zero in the array but the function is not returning anything.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var noOfPostive = 0;
  var noOfNegative = 0;
  var noOfZero = 0;
  
  function plusMinus(arr) {
    /*
     * Write your code here.
     
     */
    var length = arr.length;
  
    for (var i = 0; i &lt; arr.length; i++) {
      if (i &gt; 0) {
        noOfPostive += 1;
      } else if (i &lt; 0) {
        noOfNegative += 1;
      } else {
        noOfZero += 1;
      }
  
      var FractionOfPostive = noOfPostive / length;
      var FractionOfNegative = noOfNegative / length;
      var FractionOfZero = noOfZero / length;
      return FractionOfPostive, FractionOfPostive, FractionOfZero;
  
    }
  }
  
  plusMinus([-4,3,-9,0,4,1]);</code></pre>
  </div>
  </div>
  </p>