The aim of this puzzle: To update the objects values to store arrays []
rather than strings. The value 'bananas'
stored inside the food
property should be replaced with an array that lists two or more food items (i.e. two or more strings). The value 'map'
stored inside the equipment
property should be replaced with an array that lists two or more equipment items. And the value 'hat'
stored inside the clothing
property should be replaced with an array that lists two or more clothing items. In the end you’ll have three arrays inside the object myBackpack
.
Review concepts: The achievements ‘Used a String’, ‘Created an Array’ and ‘Accessed a Property’s Value’ unlock the ability to complete this puzzle.
Review puzzles: Try taking another a look at the puzzles ‘Passphrase Generator’ and ‘Custom Colors’ to get an idea of how to replace a string and change an objects value — as well as how to create an array.
Sample code solution:
(Tap below to reveal)
Since this is part of the final topic of the fundamentals course and it is testing your knowledge, there is no sample solution code.
JavaScript Concepts: Object Expressions, Member Expressions, Calling Functions, Data Structures (arrays)
Grasshopper Concepts: print()