JavaScript cashRegister