So let's say that I have an object literal, which is the following:
let test = {
settings: {
title: '',
has_content: true,
can_edit: false,
}
}
Now I have another object literal as shown below:
let test2 = {
...test,
settings: {
can_edit: true,
}
}
How can I bring over all the parameters from the test
object literal but have the ability to change values in test2
?
So ultimately, I'd like for this:
let test2 = {
settings: {
title: '', (This is default)
can_edit: true, (This value is changed)
has_content: true, (This is default)
}
}
Now, when I console.log test2
, all that I see in the settings is the can_edit: true
, but not the title
or has_content
.