You can do this, but it is roughly equivalent to using a battery pack to heat water for a steam engine; it is a very bad idea.
As bad of an idea as using javascript to do addition rather than assembly. You're assuming electric energy is the same order of magnitude cost as electric energy. It's possible that could change some day.