why we not have to attach resistor while connecting the buzzer.
Buzzer got its own internal resistance, and that internal resistance is enough to protect the module from any sort of short circuit, that’s why we need not attach any resistance in case of buzzers.
#Reason why buzzers have internal resistance:
Without resistance no power can be dissipated. If no power is dissipated then no sound can be emitted because power relies on the conversion of electricity to some other form (such as sound or light).
the buzzer have a internal resistance and because of that reason there is no use of connecting a external resistance to it