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

Tell us what’s happening:

Describe your issue in detail here.
The code doesnt work every way i try it tells The definition of the foods object should not be changed.

Helppp

Your code so far

let foods = {
  apples:  25,
  oranges:  32,
  plums:  28
};

// Add new entries using dot notation
foods.bananas =  13;
foods.grapes =  35;
foods.strawberries =  27;

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/121.0.0.0 Safari/537.36

Challenge Information:

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

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

Welcome to the forum @rasulfaiyaz

The object was declared with the const keyword.
Change let to const and your code will pass.

Only modify the code you are asked to. The tests make specific tests in the code. Altering any part of the code you are not asked will fail the tests.

Happy coding

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