Figure 1A shows a typical example of Switch Debounce. This circuit is supposed to enable the gate and pass input pulses when the switch is opened. The switch is tied to ground (not +5V), because of a peculiarity of bipolar TTL, it sinks substantial current from an input at LOW state approx 0.25mA, whereas in the HIGH state the input current is near zero. The problem with this circuit is that switch contacts "bounce". When the switch is closed, the two contacts actually separate and reconnect, typically 10 to 100 times over a period of about 1ms as this can be seen from the sketched waveform. This bouncing would be a great problem if there was a shift register or a counter at the output of this circuit and would respond to all those extra "pulses" caused by the bounce.
Figure 1B shows the cure. The flip flop changes state when the contacts first close. Further bouncing against that contact makes no difference,and the output is a "debounced" signal, as sketched. This debouncer circuit is widely used; the '279 "quad SR latch" lets you get four into one package.
References: The Art of Electronics 2nd Edition.
Chapter 8 "Digital Electronics".
By Paul Horowitz & Winfield Hill