This loop works, but when I add an `if` statement to it, it fails. Why?

I’m working on a Connect Four game with Minimax: https://codepen.io/acchang/pen/XWePpWB I’m stuck on the first portion of the Minimax, which is to build a function that would prioritize moves that result in three tokens in a row. I think I’m almost there, but I can’t figure out why the loop in function scorePositionHoriz() is shutting… Read More This loop works, but when I add an `if` statement to it, it fails. Why?