I have read that current is always the same within a circuit, but as far as I understood voltage is not. Every electronic part I use lowers the voltage more or less, even simple wires do this. So far, so good.
Now I wonder why it does not matter if a resistor comes before or behind an LED with respect to voltage drops caused by the parts of a circuit.
Supposed I have a very simple circuit:
9V Battery -> Resistor -> LED -> 9V Battery
Also supposed that the LED has a maximum voltage of 3V and 20 mA. So I need to calculate the desired resistor:
9V - 3V = 6V
So I need a resistor that takes 6V out, and since I want 20 mA and current is the same in the entire circuit, it's according to Ohm's law:
U = R * I
6V = R * 0,02A
R = 6V / 0,02A
R = 300 Ohm
Again, so far, so good.
Now, with a resistor taking out 6V this makes sure that only 3V are left for the LED: The battery provides 9V, the resistor uses 6V, the LED gets the remaining 3V. Everything's fine.
What I do not get is why it also works the same way if I have the resistor behind the LED. Wouldn't that mean that we have a battery providing 9V, the LED getting all the 9V, using 3V, and then 6V for the resistor remaining?
Why does this work? Shouldn't 9V be way too much for the LED? Why doesn't it matter if the resistor is set up before or behind the LED?