The aim of this puzzle: Edit the string to add another row of rainbow colors.
Walkthrough of the solution: If you have an array called list
, using list.push(...)
will take whatever is in the parentheses and add it to the end of the array. Your array is called patternArray
which contains a list of strings. The for loop takes each string and lets drawBoxes
draw it. So, to create a rainbow row and add it to patternArray
, you need to .push()
the string 'roygbiv'
which are the first letter of each color of the rainbow.
Sample code solution:
(Tap below to reveal)
patternArray.push('roygbiv');
for(var element of patternArray){
drawBoxes(element);
}
JavaScript Concepts: Code Block (for loop), Calling Functions, Identifiers, Loops, Variable Declaration, Member Expression
Grasshopper Concepts: drawBoxes()