The following code:
var ResultSet= { 'ResultSetName': "Resultset1",
Values: [ { Val1: 1, Val2: 2, Val3: 'SomeName' } ] }
var AllResults= { 'MyListName': 'SomeList', 'MyResults': { Results: [] } }
AllResults.MyResults.Results.push(ResultSet);
console.log(AllResults.MyResults);
console.log(AllResults.MyResults.Values);
Produces the output:
{ Results: [ { ResultSetName: 'Resultset1', Values: [Object] } ] }
undefined
However I would expect it to produce something like:
{ Results: [ { ResultSetName: 'Resultset1', Values: [Object] } ] }
[ { Val1: 1, Val2: 2, Val3: 'SomeName' } ]
What Am I missing? Why is the array contained in the object not copied? What would be the correct way to achieve the desired result?
(I'm using node.js 1.8.2, but I het the same behavior in a browser)