Simon Game - setTimeout is not getting cleared with clearTimeout

When I click on “off” switch I am clearing the setTimeout function and also returning “return ;”
However, this is not clearing settimeout and the game keeps continuing.
Any help is appreciated. Thanks

Put everything inside the $(document).ready callback function. That way all of those global variables are accessible inside of it.

Also, you really should consider organizing your code so that all your functions are either at the top or bottom and your main code is all in one location. You are declaring variables in between function declarations all throughout your code and it makes it very difficult to follow along.