Even for longer periods it works! (Except for DOMS if too long)
Besides, since force is a neurological stuff, you « memorize » lifted weight as you memorize playing guitar or riding a bike. It takes a short period of time to get started again, but the neural connections stay for sure.
Sadly the extra kilos gained in that time will take longer to vanish.