Random Rainbow explainer

The aim of this puzzle: Add a column of rainbow boxes (before the ‘glass’ column) and two columns of randomly colored boxes (after the ‘glass’).
Walkthrough of the solution: For this puzzle, you’ll need to add a function to the outer loop’s block {} and make a couple of edits to the inner loop. For the outer loop (the one that is iterating through 'roygbiv') you’ll need to add another column of rainbow boxes — you can do this by referencing 'c' inside of a drawBoxes() function. For the inner loop (the one that starts with var i = 0, you’ll need to increase the middle of the condition (the part between the two semi-colons) so that it repeats twice rather than once. You’ll also need to update drawBox() so that it’s picking a random color rather than drawing a blue box.
Sample code solution:
(Tap below to reveal)

for (var c of 'roygbiv'){
  drawBoxes(c);
  drawBoxes(c);
  drawBoxes('w');
  for (var i = 0; i < 2; i = i + 1) {
    drawBox(pickRandom(color));
  }
  newLine();
}

JavaScript Concepts: Binary Expression (+), Code Block (for loop), Calling Functions, Call Nesting, Identifiers, Loops, Variable Declaration
Grasshopper Concepts: drawBoxes(), drawBox, newLine(), pickRandom()