I have an object set
var obj = {
ref01:{
test:"abc"
},
ref02:{
test:"xyz"
},
ref03:{
test:"pqr"
}
}
and I have new object
const test = {
test:"def"
}
I want to update the object above with increment value of ref Now ref is03 , I want to append like ref04 and increment each time based on existing obj.
var obj = {
ref01:{
test:"abc"
},
ref02:{
test:"xyz"
},
ref03:{
test:"pqr"
},
ref04:{
test:"def"
}
}
i tried object.assign but its directly passing the value .
obj = object.assign(obj,{ref:test})
So how can i get it ?
obj = [{ref: 'abc'}, {ref: 'def'}]So you can useobj.push({ref: 'ghi'})