title: Get the length of the values in object
body: <p>I want to get the length of values from an object. If the value has no length i should get <code>0 length</code>, if value exists i should get value.</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>const object1 = {
    a: '',
    b: '5'
  };
  
  function app() {
    for (const [key, value] of Object.entries(object1)) {
      console.log(key, value)
      return {
        [key]: !object1[key].length ? '0 length' : value
      }
    }
  }
  
  console.log(app())</code></pre>
  </div>
  </div>
  </p>
  <p><strong>Question</strong>:<br></p>
  <ol>
  <li>Why i get just first value from object?</li>
  </ol>
  <pre class="lang-css prettyprint-override"><code>{
    &quot;a&quot;: &quot;0 length&quot;
  }
  </code></pre>
  <p>expect:</p>
  <pre class="lang-js prettyprint-override"><code>{
    &quot;a&quot;: &quot;0 length&quot;,
    &quot;b&quot;: 1
  }
  </code></pre>
  <ol start="2">
  <li>Why now i get in <code>console.log(key, value)</code> just the first value-key, but if i delete the return statement i get both value-key?</li>
  </ol>
  <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>const object1 = {
    a: '',
    b: '5'
  };
  
  function app() {
    for (const [key, value] of Object.entries(object1)) {
      console.log(key, value)
      // return {
      //     [key] : !object1[key].length ? '0 length' : value
      //  }
    }
  }
  
  console.log(app())</code></pre>
  </div>
  </div>
  </p>