Harry was used to spiders, because the cupboard under the stairs was full of them, and that was where he slept (PS2).
"Once they're asleep, pull out a few of their hairs and hide them in a broom cupboard."
- Hermione, referring to Crabbe and Goyle (CS12).
A little puzzled, Harry followed Dumbledore through the creaking door into a space a little smaller than the average cupboard (HBP4)
They remained shut in the cupboardlike room for hours at a time. - referring to the smallest bedroom in Shell Cottage (DH25)
U.K.: closet (Not the same meaning in the U.S., which is a wall cabinet, such as to hold dishes.)
When I read Philosopher's Stone for the first time and discovered that Harry slept in a "cupboard under the stairs," I imagined a small cabinet, which is what the word "cupboard" means in the U.S. It wasn't until later that I discovered that the meaning is quite different in Britain and that many houses had small closets built under the stairs to hold cleaning supplies, place boots and umbrellas, or hang up coats.
The poem "Old Mother Hubbard" features a cupboard if the type I imagined, as seen in the illustration below.