Electric water heaters don’t need venting or chimneys and are easier to install than gas units. They have a very high Energy Factor (they don’t lose energy) and low standby tank heat losses; and they are safer and cheaper than equivalent gas units.
But... gas water heaters can be a better choice.
Gas Water Heaters
Common electric water heaters (electric-resistance water haters) have a serious disadvantage: high running costs and the environmental carbon footprint (when the electricity comes from fossil fuel plants).
Electric-resistance water heating can cost you about two times more than gas water heating, in many areas.
Electric water heating with electric-resistance systems only makes economic sense in homes with low hot-water demand.
water heating With ground Heat Pumps (Electric water heating)
Common ground-source (geothermal) heat pumps can be equipped with a small heat exchanger, technically named the desuperheater, able to use gases produced by the heat pump compressors to heat water.
The problem is, geothermal heat pumps (with their ground-buried loop) are expensive, and aren't advantageous for energy-efficient single-family homes. They only make sense in buildings with high hot-water needs.
Water heating With Heat Pump Water Heaters (Electric Water Heating)
But there is an alternative involving other types of heat pumps. There are now stand-alone heat pumps designed to provide hot water to domestic uses.
These units cost a small fraction of geothermal heat pumps, and are a good alternative to electric-resistance water heaters in homes with significant water heating requirements. See: Heat pump water heaters.
These heat pumps can reduce energy consumption by 50% or more, bringing the price of electric water heating down to very competitive levels. The only disadvantage: these pumps may still be too big for your needs.