An inverter performs dual tasks in the sense that the needed AC power is obtained from DC power that is stored in batteries by conversion through the semi-conductor devices in the inverter.
Conversely inverter also perform the function of a charger when an AC source is passed through it, by converting the AC into DC that is used as charging current for batteries.