Assignment causing program to behave strangely
<p>I'm making a chess app for practice and I have a function called <code>movePiece</code> that gets called after a user selects a square to move a piece to. Before I call it I have a line that gets the destination piece's attribute (queen, pawn, etc..) using a dictionary:</p>

<pre><code>secondAttr = pieceDict[posStr][0]; 
</code></pre>

<p>Strangely, when I comment out this line my <code>movePiece()</code> function gets called correctly, but when I leave it in there nothing happens until I click for a third time. I'm super confused why this random line before my function call that has nothing to do with the function itself is causing such behavior.</p>

<p>Here's a jsFiddle:
<a href="https://jsfiddle.net/eqmbk0u1/" rel="nofollow">https://jsfiddle.net/eqmbk0u1/</a>
 , the pieces png's are stored on my computer so they won't show up, but they're all in their normal starting spots and when you select one it's square turns blue. See what happens when you <strong>comment out line 67</strong> vs it normally.</p>