Workshop › Battleship › Step 23 of 35
When the computer sinks your last ship, you lose: the state becomes 'lost' and the game stops.
```js
if (myFleet.every(sunk)) {
state = 'lost'
message = 'They sank your fleet'
return
}
```every(sunk) is true when all your ships are sunk.return keeps the turn from passing back to you.In computerShoots, write the block right above turn = 'you'.
Skills: Game states
← The computer shoots back A heat map →