The aim of this puzzle: Add to the list of dog names and print one out randomly.
Walkthrough of the solution: A list of names is stored in an array []
, to add to the list you’ll need to add a new entry in the array by tapping below the last answer and above the closing bracket - ]
. Use the ‘str’ key to type an answer such as 'Fido'
or 'Spot'
.
Sample code solution:
(Tap below to reveal)
var dogName = pickRandom([
'Pooky Mulder',
'Milou',
'Grandpa',
'Bosch',
'Ben'
]);
print(dogName);
JavaScript Concepts: Data Structures (Arrays), Variable Declaration, Calling Functions, Identifiers
Grasshopper Concepts: pickRandom(), print()