Battery life

There are three ways in which battery lifespan decreases. One is heat, another is regular degradation over time, and the last is charge/discharge cycles. Computers are smart enough to simply stop charging once it's full, so you don't need to worry about over charging.

If your battery gets hot, it degrades more. Simple
 * Heat.

Over time, the battery degrades. However, how fast it degrades depends on how much charge it's holding. It is somewhere around 40% that was ideal for storage (FACT CHECK THIS). Meaning that is the percentage at which the battery degrades the least.
 * Degradation.

As you charge and discharge while using the laptop... As a laptop, the battery degrades. How much you charge and discharge also determines how fast the battery degrades. For longest lifespan, you usually don't want it to go below 20 and above 80.
 * Charge/discharge cycles.

So what does this mean? Some people say "unplug at certain percentage and plug in at certain percentage" but that creates cycles, degrading their battery anyway. Since that's also a pain to do, it is recommended to simply leave one's device plugged in. Unplug it if you are not going to use the laptop for a few days when you go on a trip or something. Lastly, check in your bios or your laptop's software for options on limiting battery charge. Many Dell laptops for example have an option to choose a specific charge limit such as up to 80%, this allowing for minimized degradation while also not cycling the battery.