Basic Data Structures - Access Property Names with Bracket Notation

Tell us what’s happening:
Describe your issue in detail here.
why isn’t this working this should have passed the test!

Your code so far

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

function checkInventory(object, scannedItem) {
  // Only change code below this line
  let scannedfood = object[scannedItem];
   return scannedfood
  // Only change code above this line
}

console.log(checkInventory(foods, "apples"));

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36

Challenge: Basic Data Structures - Access Property Names with Bracket Notation

Link to the challenge:

you should not change the function defined for you to pass the challenge,so simply rest it and start over or remove the object parameter and instead use foods as an object.
in other words checkInventory function should only have the parameter scannedItem.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.