title: How can I solve this problem with array.prototype?
body: <p>I'm in a little trouble here. Can't really resolve this problem, I've been using this solution:</p>
  <pre><code> Array.prototype.all = function(callback){
      for(let i = 0; i &lt; this.length; i++){
        if(this[i] &lt; 10) return true;
    }
        if(this[i] &lt; 2) return false;
      }
  }
  </code></pre>
  <p>But it does not work. I know I'm making a rookie mistake (I'm new to learning javascript), and would love a little help on this.</p>
  <p><strong>The problem in question is this one:</strong></p>
  <pre><code>function all(fn) {
        // Write a function called all in the Array prototype,
        // that receives a function (callback). Assume fn always returns true or false.
        // The function all must return true if fn returns true when we invoke it passing all the elements of the array one by one
        // the function all must return false, if any element of the array causes fn to return false;
        // E.g:
        // [1,2,3].all(function(elem) {
        //    return elem &lt; 10;
        //  });
        // returns true
        // [1,2,3].all(function(elem) {
        //    return elem &lt; 2;
        //  });
        // returns false.
      }
  </code></pre>