so this is part of a horizontal win check method in my tic tac toe object.
oTarget = ‘o’
xTarget = ‘x’
oCount = 0;
xCount = 0;
just on a logic level why wouldn’t the ternaries being false address situations in which a sparse index is encountered on a 2D board and reset the count to 0?
As an aside. That really isn’t how you want to use ternaries. They are expressions that should evaluate to a value, not perform side effects. You usually have a single return or assignment at the start.
I would also avoid nesting them for the most part as they can get hard to read and reason about.