Check/uncheck a checkbox in the table row when any checkbox in the same row is clicked
<p>I have a simple table as following which has checkboxes in the first and last columns of each row.</p>

<pre><code>&lt;table style="width:100%"&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;input type="checkbox" /&gt;&lt;/td&gt;
    &lt;td&gt;Smith&lt;/td&gt; 
    &lt;td&gt;&lt;input type="checkbox" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;input type="checkbox" /&gt;&lt;/td&gt;
    &lt;td&gt;Jackson&lt;/td&gt; 
    &lt;td&gt;&lt;input type="checkbox" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
</code></pre>

<p>Problem: 
When I check/uncheck the last column's checkbox in the first row, the first column's checkbox in the same row should be checked/unchecked. Similarly, if I check/uncheck the first column's checkbox, the corresponding last column checkbox should be checked/unchecked.</p>

<p>How can I achieve this in javascript? Any help or pointers would be really appreciated.</p>

<p>Here is the fiddle which I have created: <a href="https://jsfiddle.net/89xt4qhu/2/" rel="noreferrer">Fiddle</a></p>

<p>Thank you.</p>