Short answer: V = IR and P = VI. 12 V across 6 Ω draws 2 A and dissipates 24 W — which is also why a resistor needs a power rating above the wattage it will actually see.
The four equations it uses
V = IR, I = V ÷ R, R = V ÷ I, P = VI, plus P = I²R and P = V² ÷ R for the cases where the missing quantity is a current or a resistance. Each is the same pair of laws rearranged, so the answers always agree with each other.
Worked example
A 60 W bulb on 230 V: I = 60 ÷ 230 = 0.261 A, R = 230 ÷ 0.261 = 881 Ω. Choose a resistor for the same current and it must be rated above 60 W — a quarter-watt part would fail immediately.