title: How to not include field in object if value is undefined
body: <p>I have the following function</p>
  
  <pre><code>const exampleFunction = (var1, var2, var3) =&gt; {
      return const targetObject = {
          var1,
          var2,
          var3,
      },
  };
  </code></pre>
  
  <p>var2 and var3 are optional variables.</p>
  
  <p>If all 3 variables were send to this function, then I need to return object with 3 fields.</p>
  
  <p>If var2 is undefined, I need to return object with 2 fields only.
  If var3 is undefined, I need to return object with 2 fields only.</p>
  
  <p>If var2 and var3 are undefined, I need to return object with 1 field only.</p>