Using a resistor is a very basic way of limiting current going through a led.
The most common way is to have multiple leds in series and then have a single resistor to limit the current going through the whole chain.
You have the classic formula Ohm's law : Voltage = Current X Resistance (V=IxR)
So from this formula you can derive a formula which lets you determine resistance value or current value :
Voltage input - ( number of leds in series x forward voltage of each LED) = Current x Resistance.
In your case, the voltage of the batteries (4.5...6v depending on battery chemistry) is lower than the total voltage of the LEDs in series (~9v) so they resorted to connecting the 3 leds in parallel, and then have a single resistor in series with the leds to limit the current. This way, the current is in theory split between the LEDs.
This is a problem, because the LEDs don't have the same forward voltage, though it's close enough. So in extreme cases, one led could have a 3v forward voltage, another could have 3.2v forward voltage, so one LED could have 25mA going through it, the other could have 20mA...
Also, if one LED dies, you're left with two LEDs that now have more current flowing through them.
If you're interested about efficiency and all that, it would be better to advance to using LED driver ICs, which allow you to not waste so much power in that resistor.
For example, let's say you want 20mA through a 3.2v resistor and you power it with 6v battery :
6v - 1 x 3.2 = 0.020 A x R => R = 2.8/0.020 = 140 ohm ... so you'll probably go with a 150 ohm resistor. Let's recalculate with the 150 :
I = 2.8 / 150 = 0.0186 or 19mA
Now we can use same formula to calculate how much power is dissipate in the resistor : P = I x I x R = 0.0186 x 0.0186 x 150 = 0.052 watts.
So basically, 3.2v x 0.0186A = 0.05952 watts go into the LED and 0.052 watts go into the resistor - over half of your battery is wasted as heat into a resistor.
For a single LED or a chain of leds that have the sum of forward voltages less than input voltage, you can easily go with a buck (step-down) led driver IC.
Here's a very cheap one, 0.45$ for one:
https://www.digikey.com/product-detail/en/diodes-incorporated/AL8860WT-7/AL8860WT-7DICT-ND/6226981It's surface mount, but the pins are spaced apart so it's fairly easy to bend the pins and solder wires to them even by hand and the datasheet is very helpful and has example circuits:
https://www.diodes.com/assets/Datasheets/AL8860.pdfSee page 2 in datasheet for example circuit - you only need a small inductor, a small resistor, a basic diode and a decoupling capacitor - the values for them are explained in datasheet (pages 11-13)
If you want to put several leds in series and the total forward voltage will be higher than input voltage, you can use a boost (step-up) led driver ic.
Here's a cheap example, 0.5$ each or 0.31$ if you buy 100 :
https://www.digikey.com/product-detail/en/diodes-incorporated/AP3019AKTR-G1/AP3019AKTR-G1DICT-ND/7708820See page 2 of datasheet for example circuit, and pages 7-9 explain how to pick the other components required (inductor, resistor) :
https://www.diodes.com/assets/Datasheets/AP3019A.pdfCompared to plain resistor to limit current, you get up to 84% efficiency with such a chip.
Besides the actual chips, the inductor and everything else won't cost you more than 0.5$..1$ so for a total of 1$ plus shipping you could basically double your battery life, and have better current control (current won't vary depending on battery voltage as the led driver IC will dynamically adjust things to keep current constant)