Why does this work you may ask?
"Handover. Handover is the operation in which a device switches from one network to another or from one tower to another. Handover is the critical component that makes any cellular wireless network possible. Without handover, a user would have to manually select a new tower every time the user leaves the range of a tower. (WiFi is an example of a wireless network technology that doesn’t inherently support handover.) When the user travels outside the range of a WiFi network, the WiFi radio will just drop the connection. For cellular networks, the range of a tower is not very predictable due to factors outside of anyone’s control (like the weather, etc.)."
So basically, Wi-Fi is stable. Once you leave wi-fi, it just drops the connection, not hurting your battery. When using 3G/4G, it keeps switching from one tower to the next while moving, hurting your battery.
So wi-fi will not hurt you if you are moving around (much) and while in the same place, using wi-fi is better than 3G/4G.