Consider a conductor of resistance R, potential difference across it V and I is current flowing for some time t.
Total charge flow from one end to other q = It. Also work done in carry a charge from one end to other of conductor is
W=Potential difference x charge = Vq = VIt =I2Rt joules.
I2Rt is called electric work done which appears as heat.
H=W= I2Rt joules = I2Rt/4.18 calories.
Joule heating effect is irreversible. If direction of current changed it will not produce cooling but heat only.