The idea of making a carriage that was driven by electricity originated with a Scottish inventor named Robert Anderson, who built a crude battery-propelled carriage sometime between 1832 and 1839. The batteries weren't rechargeable -- in fact, the lead-acid rechargeable battery that's used in most cars today hadn't even been invented yet -- so Anderson's electric vehicle didn't have much impact on the history of automobiles. But despite being something of a footnote in automotive history books, Anderson was the inventor of the electric car.
An electric car is powered by an electric motor rather than a gasoine engine. It consists of electric motor. This motor gets power from a controller. The controller gets its power form the array of rechargeable batteries.
The controller takes power from the batteries and delivers it to the motor. The accelerator pedal hooks to a pair of potentiometers i.e., variable resistors, and these potentiometers provide the signal that tells the controller how much power it is supposed to deliver. The controller can deliver zero power, full power when the driver floors the accelerator pedal, or any power level in between.