Pack Your Bag explainer


@Dak_Amum Looks like you’ve accidentally inserted a string rather than the variable and property on the last line of your code. A string is surrounded by quotes, so instead of print (‘myBackpack.Food’); we want print (; without the single quotation marks. You should be able to delete the string and then look for the myBackpack variable as it’s own button. Then, with myBackpack still highlighted, look for the .food property button to add it onto the end of your variable.


Great! Thanks RetroJLO.


Please kindly advice


I was able to complete the puzzle, but the accepted solution code is incorrect. There should not be a comma after the last object property. Perhaps the app should add a comma to the preceding property only when adding a new property.


@Jeff_Geller That is correct but since the learning app has generic syntax it is showing that last comma. It bugged me as well but I dismissed it as being a starting point. But your right when we try this in real life errors will happen and confuse users. Perhaps this can be fixed @grasshopper, @Grasshopper_Heather?


Hey @Jeff_Geller and @Ahsen,

We have the extra field for Arrays and Objects to make it easy for users to tap to add new items/properties (without it the touch targets are very small and annoying).

Technically, there is a value there (we call it the placeholder), but you’re right that this could likely be a point of confusion for users. We’ve specifically avoided teaching syntax structure in Grasshopper so far, to allow users to understand key coding concepts without being tripped-up over small issues.

In the (longer-term) future we do plan on giving users a more real-life IDE experience, but we’re still figuring out what that will look like.

Thank you both for your feedback!
H :slight_smile:


Please help me out, I seem to have the same problem with my backpack…


I am also facing issue with pack your bag problem. According to me my code is correct but it is not moving further.


Hello @Wiebe_Kraak,
Your code is correct, however the solution wants you to print food and not clothes.

So change print(my backpack.clothes);

Good luck :slight_smile:


Hello @tarunaaggarwal,
Can you please show your code so we can better assist you?



OK… Problem fixed!:roll_eyes:


I’m stuck on this problem as well.


I don’t know why, I insisted writing myBackPack and it got me stuck until I saw your post. Thanks.


Hey @Nolan_Code,

You don’t need to create new variables inside an object, but rather one variable called myBackpack then properties inside it, like:

var myBackpack = {
food: 'bananas'

I hope this helps!
H :slight_smile:



JS is case sensitive, so you need to capitalize the ‘B’, as in ‘myBackpack’.


Well what @James_Boblak said is correct but your code is also partly valid. You are defining mybackpack twice which can be done but really not something you should do.

Define it as a string of just x:

var mybackpack = ‘x’;

Defined as an array:

var mybackpack = {


Also my guess is that grasshopper is specifically looking for the exact syntax including casing which is why it is giving an error. I hope that helps :slight_smile:



Thank you it’s working God



Hi all,

I have the code right and running it gives me the right answer. Unfortunately though I have an extra object that I can’t remove as tapping on it and pressing the delete button removes my whole code. Please help!