title: Given array, write a function that returns an order object
body: <p>I need to write a function, allCandyOrders(inventory), that returns an order object (I'm not sure what that means). The keys should be the names of the candies, and the values should be the amounts to be ordered. If the stock is greater than weekly average, order 0
  if the stock is less than weekly average, order 2 times the average.</p>
  <p>Example output:</p>
  <pre><code>{
    &quot;Twizzlers&quot;: 400,
    &quot;Sour Patch Kids&quot;: 200,
    &quot;Milk Duds&quot;: 0,
    &quot;Now and Laters&quot;: 0
  }
  </code></pre>
  <p>Given array:</p>
  <pre><code>let inventory = [
    { candy: &quot;Twizzlers&quot;, inStock: 180, weeklyAverage: 200 },
    { candy: &quot;Sour Patch Kids&quot;, inStock: 90, weeklyAverage: 100 },
    { candy: &quot;Milk Duds&quot;, inStock: 300, weeklyAverage: 170 },
    { candy: &quot;Now and Laters&quot;, inStock: 150, weeklyAverage: 40 }
  ];
  </code></pre>
  <p>What I have so far:</p>
  <pre><code>function allCandyOrders(inventory) {
    for (let i = 0; i &lt; inventory.length; i++) {
      if (inventory[i].inStock &lt; inventory[i].weeklyAverage) {
        return inventory[i].weeklyAverage * 2;
      } else {
        return 0;
      }
    }
    return 0;
  }
  </code></pre>