Workshop › Sudoku › Step 8 of 28
When the selected cell holds a digit, every cell with the same digit lights up in blue: you see at once where that digit already is.
```js
const d = selected && grid[selected.r][selected.c]
if (d && grid[r][c] === d) fill = '#bfdbfe'
```d is the digit in the selected cell (0 if it is empty), worked out once before the loops.d && ... skips the rule when the cell is empty (0 counts as false).draw, write the d line above the cell loops.Skills: Game states
← Light up row, column and box Click to select →