Basic Data Structures - Add Key-Value Pairs to JavaScript Objects

Tell us what’s happening:

The definition of the foods object should not be changed. This test case is not solved

Your code so far

let foods = {
  apples: 25,
  oranges: 32,
  plums: 28
};
// change code below this line
foods["bananas"] = 13;
foods["grapes"] = 35;
foods["strawberries"] = 27;
// change code above this line
console.log(foods);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36

Challenge Information:

Basic Data Structures - Add Key-Value Pairs to JavaScript Objects

Welcome to the forum!

The given definition of food variable was:

const foods 

Why did you change it to let?

Otherwise, there is no problem with your code.
So reset the code and try again or change let back to const

Thank you for the reply

1 Like