title: How to get keys and values of an object into a comma separated string?
body: <p>I have an object that looks like this:</p>
  
  <pre><code>obj = { apples: 2, eggs: 4, potato: 1 }
  </code></pre>
  
  <p>And I would like to return a string that looks like this: <code>I have 2 apples, 4 eggs, 1 potato</code>. </p>
  
  <p>I tried the following:</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>arr = [];
  obj = { apples: 2, eggs: 4, potato: 1 };
  
  for (var key in obj) {
      if (obj.hasOwnProperty(key)) {
          arr.push(`${obj[key]} ${key}`)
      }
  }
  
  console.log(arr);
  
  for (i=0; i&lt;arr.length; i++) {
    console.log(`I have ${arr[i]}`)
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>I don't know how to put them together</p>