How can I insert the values in array of objects based on one value condition?
opayloadchild = [];
for (let i = 0; i < j; i++) {
opayloadchild.push({
"A": "123456",
"B": data[i].x,
"C": data[i].y,
"D": data[i].z.toUpperCase(),
"E": data[i].d.toUpperCase(),
"F": data[i].e.toUpperCase()
})
}
In the above code I want to check inside the for-loop like if data[i].x
is null or not.
If data[i].x = null then insert "" else the value.
How can I achieved this?