This is just a style, mainly, probably some efficiency obtained in IE, although new JS engines will in any case integrate the function through their tracing mechanism. You can get rid of the JSLint "error" like this:
function setupPlayer(player) { var stillAlive = false; $board.find("td").each( function() { if( $(this).data("owner") === player.number ) { stillAlive = true; return false; } }); if( !stillAlive ) {
Do you have to? Personally, I would ignore it in this case for the convenience of maintenance, for me the current version is much easier to read / maintain. Your call is here, which version is best for you? In any case, this is likely to have little effect on performance.
Bit tangent but related:
What has a greater impact on performance is caching the <td> selector, bypassing the DOM is quite expensive. I would do this before your for loop:
var cells = $board.find("td");
And use cells inside the loop, no need to search for the same elements again :)
source share