title: function that takes an array as its first argument and a function as a second
body: <p>I have to write the function that takes the array as its first argument and a function as a second. So it should return true only when the predicate returns true for all elements of the array. I've written two functions: "every" which takes an array and another function called "isOne" (which detects if a certain element is equal to one or not), but for some reason it doesn't work. Please, help me to find where's the problem.</p>
  
  <pre><code>let someArray = [1,1,1];
  
  function every(array, someFunction) {
    var i = 0;
    var element = array[i];
    while (i &lt; array.length) {
      if (someFunction == false) {
          return false;
          break;
      }
      else {
          return true;
          i++;
      }
    }
  }
  
  function ifOne (element) {
      if (element !== 1) {
          return false;
      }
      else {
          return true;
      }
  }
  
  console.log(every(someArray, ifOne()));
  </code></pre>