I am writing a nested For Loop. Trying to setup a break but doesn't seem to work. Here is what I am trying to do. As an example:
var playersList = sam,tom,jane
var playersDrafted = tom,jane
Sam is not found in playersDrafted, so I want Sam's name to not have a line strike. Tom and Jane are found in the playersDrafted, so I do want there names to have a line strike. The code I've written is returning this:
sam
sam
tom
tom
jane
jane
The result should be:
sam
tom
jane
Any advice would be greatly appreciated.
<div>
  <table align="center">     
    <? for(var i=0;i<playersList.length;i++){ ?>
        here:
        <? for(var y=0;y<playersDrafted.length;y++){ ?>
             <? if(playersList[i]==playersDrafted[y]) { ?> 
                 <tr>
                   <td style="text-decoration: line-through;"><?= 
playersList[i]; ?></td>                    
                </tr> 
                 <? break here; ?>
             <? } ?>              
        <? } ?>
             <tr>
                <td><?= 
playersList[i]; ?></td>                    
             </tr> 
    <? } ?> 
  </table>
</div>
 
     
    