That was the case, I think, with old NiCd batteries, but with lithium ion batteries, you maximize battery longevity by keeping it mostly charged, I read recently.
What’s different between them is battery memory effect. With NiCd & NiMH you are supposed to let it discharge until 20%, then continuously charge up, and then repeat.
With Lithium based batteries it’s a recommended practice to charge in short bursts and keep the battery at a medium level.
In any case, most devices now a days will manage the battery in ways that you should not really bother. It’s amazing the conplexity that battery systems have nowadays.