What's in Store explainer


The aim of this puzzle: Check if each item in the shopping list is in the departments array.

Walkthrough of the solution: The departments array is imported from 'grasshopper.store'. Then shoppingList array is created. The last part of the code is the For Loop.

The loop goes through each item of the shoppingList. It logs some output for each item. Take a look at what it’s logging: item + ': ' + departments.includes('clothing')

1st is the item which is just the current item in the shoppingList. Then a ': ' which is just a string used to organize the output. The last part is departments.includes('clothing'). That will check if the string 'clothing' is an item of the departments array. Instead of searching for 'clothing' each time, it should check for the current item. Change this string to the item variable.

Sample code solution:
(Tap below to reveal)

import { goods } from 'grasshopper.store';

let shoppingList = [

for (let item of shoppingList) {
  console.log(item + ': ' + goods.includes(item));

JavaScript Concepts: Binary Expression (+ concatenation), Code Block (for loop), Data Structures (array), import, .includes()

1 Like
What's in store
Whats in store explainer
listed #2

Continuing the discussion from What's in Store explainer:



This puzzle originally used a variable called departments, but now it uses goods. Be sure to use the variable goods and not a string 'goods'.


1 Like

What is wrong? Help


The puzzle is being strict here. The starter code uses item as the looping variable instead of element.

Your code will give the correct result, but to pass the puzzle, you can rename element to item by double tapping on the element in let element.



Not able to add element in console.log


I’ve updated the explainer from element to item as it is in the puzzle. Thanks for catching that!


1 Like