A pawn is the only piece that captures differently from how it moves: one square diagonally forward, and only onto
an enemy piece.
```js
for (const dc of [-1, 1]) {
const tr = r + dir
const tc = c + dc
if (!inside(tr, tc)) continue
if (board[tr][tc] && board[tr][tc][0] !== color) add(r, c, tr, tc)
}
```
What it means
for (const dc of [-1, 1]) tries the column to the left and to the right.
if (!inside(tr, tc)) continue skips a square off the edge (a pawn on the a- or h-file).
The capture needs a piece there (board[tr][tc]) of the other color.
Your turn
Inside the pawn block, under the closing } of the forward-move if, write the capture loop.