How can I create the MissingUserIdsArray from MainArray in JavaScript?
var MainArray = [
[
"10148835*1,2,3,",
"1,2,3,4,5,"
],
[
"10148839*4,5,",
"1,2,3,4,5,"
]
];
const MappedArrray = MainArray.map(arr => {
const SplitID = arr[0].split("*");
return {"AppId": SplitID[0], "AppUserIds": SplitID[1].split(","), "MeetingUserIds": arr[1].split(",")};
});
console.log(MappedArrray);
//My above code is working fine. Just need to make MissingUserIdsArray array in the format I mentioned.
const MissingUserIdsArray = MappedArrray.map(arr => arr.MeetingUserIds.filter(x => !arr.AppUserIds.includes(x)));
console.log(MissingUserIdsArray);
//Need to create MissingUserIdsArray in the following format:
/*
MissingUserIdsArray = [
{"AppId": 10148835, "MissingUserIds": "4,5"},
{"AppId": 10148839, "MissingUserIds": "1,2,3"},
]
*/