I have the following problem :
var a = {
'a': '',
'b': ''
},
b = [1,3],
o = {};
for (i = 0; i<b.length; i++) {
o['shop' + b[i]] = a;
o['shop' + b[i]].store = b[i];
}
console.log(JSON.stringify(o));
Expecting shop[n] will be equal to store value, but it's wrong
{
"shop1" : {
"a" : "",
"b" : "",
"store":3
},
"shop3" : {
"a" : "",
"b" : "",
"store":3
}
}
What's wrong with it?