Aim of the puzzle: Change the value of a property in an object from a string to an array.
Walk through of solution: In the code that you start off with, the hobbies
property contains the string 'napping'
. To complete the puzzle, replace 'napping'
with an array that stores 2 or more strings. For example, ['napping', 'eating']
.
Sample code solution:
(Tap below to reveal)
var pet = {
name: 'Moo',
animal: 'cat',
hobbies: ['napping', 'eating']
};
print(pet.hobbies);
Javascript Concepts: Variables, Objects, Properties, Dot Notation
Grasshopper Concepts:print()