Should I always check if a variable was changed, or just change it regardless?
<p>I have the following code (Javascript):</p>

<pre><code>var boolA = false;
var boolB = Math.random()*2 ? true : false;
</code></pre>

<p>I don't know if boolB will be true or false, but I need to update boolA with it anyway every tick. Should I just update it or check if it was changed?</p>

<p>Which is fastest?</p>

<pre><code>boolA = boolB;
</code></pre>

<p>or</p>

<pre><code>if ( boolB != boolA ) boolA = boolB;
</code></pre>

<p>What about integers, strings and other objects? </p>

<p>Thank you in advance!</p>
