Every time the battery has to be recharged a significant amount, it counts towards the total number of times the battery was designed to be recharged. ALL batteries have a limit to the number of times they can be recharged. Typically the batteries in laptops and iPads and iPhones will last a few to several years under normal usage conditions. But if you recharge a laptop every night after running it on battery power during the day, it will use up significantly more of its maximum number of charge cycles than a laptop that stays plugged in most of the time and maintains a 70-80% charge. Apple has a battery maintenance mode in their MacBooks that when plugged in keeps the average battery level between 70-80% for optimum battery longevity. I've got a 2014 MacBook Pro which after 8 years of daily use still has a good battery because it rarely runs without being plugged in on my desk. I recently upgraded to a 2020 MacBook Air M1 but kept the 2014 MacBook Pro as a backup. I tend to keep my Macs for many, many years, and I have never had a battery die because I keep them plugged in the vast majority of the time.
Not everyone has the ability to keep their laptop plugged in most of the time, but if you do, it can extend the life of its battery quite a bit. The best thing for those who need to use their laptop on a regular basis without being plugged in is to never let it fall too low in charge level before recharging. If you let your battery go down to 20% or less on a regular basis, then you are having to put it through a stressful full cycle recharge on a regular basis, and it will wear out the battery fairly quickly. In such a scenario, it is better to carry along an external battery supply to plug into it before its remaining charge level gets that low.