Https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-data-structures/access-property-names-with-bracket-notation

What is the reason why thos does not work?

let foods = {
  apples: 25,
  oranges: 32,
  plums: 28,
  bananas: 13,
  grapes: 35,
  strawberries: 27
};

function checkInventory(scannedItem) {
  // Only change code below this line


let currentValue=foods[scannedItem];

  // Only change code above this line
}

console.log(checkInventory("plums"));

You aren’t returning anything from the checkInventory function. You should use the reserved keyword return.

2 Likes