Workshop › Flappy-style Bird › Step 18 of 30
A pipe that has left the screen on the left is useless, but it stays in the array forever. We keep only the pipes whose right edge is still on screen.
```js
pipes = pipes.filter((pipe) => pipe.x + PIPE_WIDTH > 0)
```filter makes a new array with only the items that pass the test.pipe.x + PIPE_WIDTH is the pipe's right edge; while it is above 0, part of the pipe is still visible.In update, under the pipe loop's closing }, write the filter line.
Skills: Arrays and objects
← A pipe every 90 frames Is the bird level with a pipe? →