Unfortunately, factory laptop batteries tend to have reduced lifespans, so your laptop’s battery life will usually not match the factory estimates. Battery life reduces each time you have to charge it, so consider keeping your laptop plugged into a power cable until you absolutely have to use the battery.
If the laptop is constantly plugged in, there is some risk of overcharging. However, modern laptops have built-in protections against overcharging — if they detect that you tend to keep the laptop plugged in most of the time, they will occasionally discharge the battery a little bit to maximize its lifespan. Make sure that you have enabled this functionality if available on your laptop. For Macs, this is available at System Preferences > Battery > Battery as “Optimized battery charging”. It’s usually better to just leave the laptop plugged in and let the machine do the occasional discharge, rather than unplug the power cord yourself every few days. However, older laptops may not have this overcharge protection functionality, so if you’re using an older laptop and never need to unplug it in your regular use, you may want to unplug for an hour or two every week.