title: Why is this JavaScript valid?
body: <p>Today I was getting a weird syntax issue and noticed something odd. This actually compiles as valid JS: </p>
  
  <pre><code>confusing: { thisWorks: 'why?' }
  </code></pre>
  
  <p>It prints "why" to the console.</p>
  
  <p>Any ideas why that is? </p>
  
  <p>You can also wrap it in a function like this:</p>
  
  <pre><code>// calling myFunc() returns undefined
  const myFunc = () =&gt; {
    confusing: { thisWorks: 'why?' }
  };
  </code></pre>
  
  <p>Must be some corner of JS that I've just never encountered before? Seems like weird behavior resulting from syntax that isn't correct but at the same time doesn't actually cause an error? </p>