The scenario is to dynamically add some properties to JavaScript object at once.
For example, there is an object "data"
var data = {
PropertyA: 1,
PropertyB: 2,
PropertyC: 3,
}
Then add extra data to "data"
if(true){
var extraData = {
PropertyD: 4,
PropertyE: 5,
PropertyF: 6,
}
} else {
var extraData = {
PropertyX: 4,
PropertyY: 5,
PropertyZ: 6,
}
}
What is the best way or the easiest to add "extraData" to "Data"?