title: Is it possible to initialize methods and properties in object initialization?
body: <p>For example to minimize code like:</p>
  <pre><code>return (()=&gt; {
          let c = document.createElement(&quot;col&quot;);
          c.appendChild((()=&gt;{
              let p = document.createElement(&quot;p&quot;);
              p.innerText = &quot;Hello&quot;;
              return p;
          })());
          c.appendChild((()=&gt;{
              let p = document.createElement(&quot;p&quot;);
              p.innerText = &quot;World&quot;;
              return p;
          })());
          return c;
      })();
  </code></pre>
  <p>or:</p>
  <pre><code>let col = document.createElement(&quot;col&quot;);
  let title0 = document.createElement(&quot;p&quot;);
  title0.innerText = &quot;Hello&quot;;
  let title1 = document.createElement(&quot;p&quot;);
  title1.innerText = &quot;World&quot;;
  col.appendChild(title0);
  col.appendChild(title1);
  return col;
  </code></pre>
  <p>into something along the lines of:</p>
  <pre><code>return document.createElement(&quot;col&quot;, {
      appendChild(document.createElement(&quot;p&quot;, {
          innerText = &quot;Hello&quot;
      })),
      appendChild(document.createElement(&quot;p&quot;, {
          innerText = &quot;World&quot;
      }))
  });
  </code></pre>
  <p>I know field initializers exist (Which is what I based my pseudocode on), but is it possible to do something similar with methods and properties?</p>