Need help with main loop in Simon Game and using setTimeout

Hello there. I am hoping someone can help me with making progress on the Simon Game challenge. I posted a question on the HelpJavascript Gitter page but I don’t think anyone has time to look at my code there. I am confused about using setTimeout in the main control loop and have only got as far as getting the part that plays the notes and then lets the user interact with the board. I would so appreciate it if someone could let me know if any my loop examples are close to what should be correct. None of them work. My code so far is posted on github,
at https://gist.github.com/greaneym/055b80a1c9ab686f3ae01f3bdb1584f2
and you can see it “not working” at this link,https://bl.ocks.org/greaneym/055b80a1c9ab686f3ae01f3bdb1584f2
thanks for any help!
Margaret G.