I'm struggling to insert an Object into a complex array. My attempt looks like this: "DUMMY_PLACES[0].todos.byIds.push," but I am unable to make it work. I have an id and content for the object, and the completed property should default to false. I hope someone can help me with this seemingly simple task that I can't seem to figure out. Additionally, I would appreciate any assistance with implementing the delete option.
For example, I have (5, test5), and I want to achieve the desired outcome.
const DUMMY_PLACES = [
{
todos: {
allIds: [1, 2, 3, 4,],
byIds: {
"1": {
content: "test1",
completed: false,
},
"2": {
content: "test2",
completed: false,
},
"3": {
content: "test3\\",
completed: false,
},
"4": {
content: "test4",
completed: false,
},
},
},
visibilityFilter: "all",
},
];
const DUMMY_PLACES = [
{
todos: {
allIds: [1, 2, 3, 4,5],
byIds: {
"1": {
content: "test1",
completed: false,
},
"2": {
content: "test2",
completed: false,
},
"3": {
content: "test3\\",
completed: false,
},
"4": {
content: "test4",
completed: false,
},
"5": {
content: "test5",
completed: false,
},
},
},
visibilityFilter: "all",
},
];