Yeah, it's terrible math unless you're buying a Nissan Leaf (lowest priced all electric).
Not only will you go in debt on the initial buy for the car (even for a used one) but you will have to drop another $6,000 - $8,000 for new batteries in 8 - 10 years.
Why go through all of this when they just got ICE cars to be able to last for a good long time? I got rid of my Toyota Corolla a couple of years ago, it was 15 years old and had almost 200,00 miles on it. The only reason that I got rid of her is because she'd already been totaled out from hail damage and the transmission needed to be replaced, so at that point the repairs were more than she was worth. Now I'm driving a 14 year old Dodge Caravan with 177,000 miles. It's a gas hog and if I was made to work from my office then I'd have to replace with something better on gas, but I'm fortunate that I can still work from home.