`else if (cardIndex)` is shorter and works in JS.