Doubt in Question no. 5 of javascript assignment

Hello mam/sir,
Can you please explain question no.5 of the electricity unit problem. I tried but did not understand the logic properly, I am baffled.