I think I found it.
for (; timesByStart <= timesByEnd; timesByStart++);
is the line that is screwing you up. I had no idea it would cause
JS to mess up but the " ; " you have after the function parameters is what is doing it. Take out the semicolon from that line and you should be good to go.
I am totally new to Java Script and these chapter 3 examples nearly made me want to jump off the roof. This stuff is pretty hard for me.