Workshop › Klondike Solitaire › Step 20 of 40
A foundation is built in one suit, from the ace up: an empty one takes only an ace, then the 2 of the same suit, and so
on. canFound has the same shape as canStack.
```js
// Foundation: same suit, one higher, starting from the ace.
function canFound(card, pile) {
const under = last(pile)
if (!under) return card.rank === 1
return under.suit === card.suit && under.rank === card.rank - 1
}
```!under) takes only an ace, rank 1.Under canStack, leave an empty line and write canFound with its comment.
Skills: Functions
← Rule 1: building a column Move cards by the rules →