Randomized Flag explainer

The aim of this puzzle: Create a flag with three vertical stripes where the middle stripe is the same randomly assigned color.
Walkthrough of the solution: To make multiple boxes have the same randomly assigned color, that color will need to be ‘stored’ somewhere. You can do this using a variable. For the variable, called x in this case, to store a randomly selected color, pickRandom(color) needs to be used. You can then reference the variable, x, inside drawBox() to draw a box with that randomly selected color — like drawBox(x). You’ll need three drawBox(x)’s to create a stripe of color in the flag.
Sample code solution:
(Tap below to reveal)

var x = pickRandom(color);
drawBox(blue);
drawBox(x);
drawBox(red);
newLine();
drawBox(blue);
drawBox(x);
drawBox(red);
newLine();
drawBox(blue);
drawBox(x);
drawBox(red);

JavaScript Concepts: Identifiers, Calling Functions, Call Nesting
Grasshopper Concepts: drawBox(), newLine(), pickRandom()