The JK Flip Flop has three inputs -- inverse of J, inverse of K, and a clock pulse.
The clock pulse has to be set to 1 and then set to 0 before a change can successfully register.
It avoids the invalid state but simply toggling states if both inverse of J and inverse of K are set to 1 during a clock pulse.