title: Prevent javascript from evaluating object property first
body: <p>I am creating a game of chess and have this line of code:</p>
  <pre><code>void (!selectedPiece.moved &amp;&amp; selectedPiece.moved = true);
  </code></pre>
  <p>What it does, is check if <code>selectedPiece.moved</code> is false, and if it is, continue and set <code>selectedPiece.moved</code> to true.</p>
  <p>As @Klaycon said, it reads it like this:</p>
  <pre><code>void (!selectedPiece.moved &amp;&amp; selectedPiece.moved) = true;
  </code></pre>
  <p>And that is when I get an invalid left-hand side assignment. I know I could replace it with an if statement but I was wondering if there was something else I could do to fix it.</p>