I am new to Javascript, I want to initialize my object in the following way
{
'101' : {
Name: 'A',
Add: '123'
},
'115' : {
Name: 'B',
Add: '456'
}
}
and so on, I am going to execute this in a loop, the key(101,115..) is unique and value should be an object.
I tried the follow but it didn't work
let obj = {}
for(i=0; i<N; i++) {
let id = getId(i);
let Name = getName(i);
let Add = getAdd(i);
obj.id = {
Name: name,
Add: add
}
}