Let me know if these are too small a nitpick. I am not sure really.
Unit 5 lesson 10 step 8 we see the variables R, G, and B set to the basic color. We then reuse them to set the difference color. I would consider that changing what a variable means, a bad idea. That is, if we wanted to know the red value of the original color where in the code do we use R and where do we use R - 20? In a small function, it might be obvious, but it is a bad practice. Also, Javascript best practice limits capitalizing the first character of a variable for use with object constructors. That last part is probably too small a nit.
Soon after that Alexis says:
Well, I know that’s actually not a problem. If you try to specify a color as something like
rgb(270, 290, 300)
the actual color will end up beingrgb(255,255,255)
anyway. It doesn’t break the system, I tried it back when we were doing turtle programming.
Okay, what we seem to see here is Alexis trying something and finding out how rgb() works for out of range values and is now going to use that. It should say that Alexis checked the documentation for the API and knows how rgb() handles values out of range. The difference is in using an undocumented feature of an API and using a documented feature. The former is a bad idea. In the end, they fix it. So no big deal?
Step 12. Alexis talks about adding a function checkCorrect(). It has the single responsibility of checking how many points are scored and saving the score. And then setBoard() is added to it. Now that single minded appropriately named function has additional functionality. At first, it doesn’t seem too bad.
And then we add switchPlayer(). And we add more implementation details having to do with scoring for two players. CheckCorrect() is getting complex. The final straw comes when we add checkGameOver().
In my humble, okay not so much, opinion there should be an extra function added with a name that describes taking a turn in the game like this:
function playerTakesTurn (guess) {
checkCorrect(guess);
checkGameOver();
setBoard();
switchPlayer();
}
At some point Alexis, the trouble maker, should point out checkCorrect() no longer does what it says.