Need to create a specific array of objects with the given objects. Now I have used object of assign.
Here is
var str = [{componentName: "Transformer", type: "PUB", beanName: "TransformerExtractor", state: "enabled", config: {"test":"test"}},{componentName: "DBEE", type: "PUBSUB", beanName: "DBEErExtractor", state: "enabled", config: {"test":"test"}}];
var A1 = [];
var B1 = [];
finalOutput = [];
for(i=0;i<str.length;i++){
alert(str.length);
var output = {};
output.flowId = "Flow1234";
output.flowAlias = "Flow1234";
output.description = "Flow1234";
output.state = "Enabled";
A1.push(output);
alert (A1);
B1.push(str[i]);
alert (B1);
finalOutput = [A1, B1].map(o => Object.assign({}, A1, o));
}
alert (finalOutput);
return finalOutput;
Could you please tell me how do I get my expected result like [{A1,B1(from first set of variable str),{A1,B1(from 2nd set of variable str)]