I'm attempting to create a nested object with the same name but different value in this way : example..
const myTestfunction =():void=> {
const licenses = {};
valsLicenses.forEach((valLicense) => {
let license:any = {};
valLicense.forEach((elem, i, arr) => {
license["licenseId"] = arr[0];
license["expireDate"] = arr[1];
license["os"] = arr[2];
Object.assign(licenses, license);
});
});
};
and i'd want a JSON object something like this {license:{...},license:{...},license:{...}}
Nevertheless, when I check the object, only the last three value are stored inside the object, i think that this happens because when the object is initialized, the object's address does not change, but I do not spot a solution to add a newly initialized object with the same name inside the same object...how could I resolve it?