Workshop › Tic-tac-toe › Step 29 of 33
If the computer cannot win, it should stop you from winning. That is the same question with X: which free cell would complete a line for X? Take it.
```js
return completes('O') ?? completes('X') ?? (cells[4] === '' ? 4 : random)
```In the return line, add completes('X') ?? after completes('O') ?? .
Skills: Functions
← Rule two: win when you can Score a finished game →