I often hear still saying that battery replacements are one of the worst this electric cars need. Apparently half the world thinks that the cars outlive the batteries by a large degree, and not the other way around. But in the United States for instance, battery warranty is eight years by law, and some brands even offer ten years.
And batteries are becoming ever better. According to Elon Musk the current Model 3 has a battery that should easily last half a million miles. And that is not even the new battery chmeistry they are still developing.
In this Youtube someone discusses the cost of a battery replacement for various car types, so it might be worth watching if you're thinking of buying one...