In the two exercises just above this section, when you click for the first solution, it instead shows you the second solution.
I think the fix would be to change here from solution = to const solution = or let solution = , for proper lexical scope. I'm not confident enough in my JS to make a PR, though.