According to this study carried out by Consumer Reports, electric water heaters are an energy-efficient way of getting hot water.
Electric hot water heaters are generally more easier to use when comparing against an equivalent gas unit.
The installation and maintenance costs of these units is often lower, as they don't require venting.
Additionally, electric water heaters can be used in any home that simply has electricity, whereas not every home has gas, with apartment buildings often only having electricity available for safety reasons.