I have an Object initially like the following
var data={title: "Italy"}
I want t check few conditions and then add to the data whoch met the condoitions :
if(condition1)
//output will be data={title: "Italy",id1: somecaluatedvalue}
if(condition2)
/*output will be data={title: "Italy",id1: somecaluatedvalue,id2: somevalue}
if condition1 was also true or data={title: "Italy",id1=2: somecaluatedvalue} if
condition1 was false */
It will continue in this way inside a loop. How can i do this in javascript?