Backpack Mistake explainer


Hello guys, I can not edit the right side of the equality. Please, help me. Thank you.



Hey @Carlos_Eduardo_Costa,

You don’t need to create the otherBackpack object to solve this puzzle. You may find the puzzle explainer here useful.

H :slight_smile:


var Hunger =
When I am using this code, it is asking me to remove the 2nd variable declaration outside the for loop,even there is nothing outside the for loop. Can I get some help?



Thanks for flagging this! The wording of that hint should let you know that you don’t need to create two variables to solve this puzzle (the only one you need is the looping variable: for (var element .... )). We’re working on updating this hint!

Thanks again for pointing this out,
H :slight_smile:


You’re welcome! Actually, now I have solved the code. Thank you for informing.


I got here and now in very confused on what to next I went a practice of this problem but no help


If you scroll up to the 1st post here, you can take a look at what the otherBackpack actually looks like:

var otherBackpack = {
    food: ['crackers', 'chocolate', 'raisins'],
    equipment: ['map', 'rope', 'compass'],
    clothing: ['hat', 'umbrella', 'boots']

It’s an object with 3 properties: food, equipment, and clothing. Each of those properties is storing an array. Since you want to print out all the food in the backpack, you want to loop through the which is the "food property of the otherBackpack".

Inside the loop, you want to print() the element. The element will store each food item as it loops through the array.



I tried this and it worked!

for (var element of {
print (element);
That really worked!