Wouldn't it have the same effect like if I was driving along and just took my foot off the gas for a few moments to slow down?
Yes. Exactly the same effect.
What would taking your foot off the gas do to the transmission?
It depends on whether you have a standard or an automatic, and what gear you're in.
With a standard, when you let off the gas, the transmission is still engaged and you immediately start to slow down. Your forward motion (kinetic energy) is being translated into heat in the transmission. If too much heat builds up (you use the transmission to slow yourself going down a long hill) then it will damage the transmission.
With an automatic, you typically coast when you let off the gas. The transmission is not engaged, and you slow slightly. As long as you're just in drive, versus first or second gear, this is fine. If you're in one of the lower gears, then the transmission is probably still engaged and you're in a similar situation as above. This is why putting an automatic in low gear and going down a hill is a bad idea.
with an electric car, wouldn't you want to hit the brakes to recharge the battery?