I have an object which always have a property and an array. When I print it out with console.log(obj)
. It likes the following.
ProjectName: MyTest1
[0] { foo: 1, bar: 2}
[1] { foo: 3, bar: 4}
[2] { foo: 5, bar: 6}
Or
ProjectName: MyTest2
[0] { foo: 1, bar: 2}
[1] { foo: 3, bar: 4}
[2] { foo: 5, bar: 6}
[3] { foo: 6, bar: 7}
UPDATE
There are hundreds of them from backend, so the array's size is not fixed. But the object is always a single property plus an array. This object is a combination of a json object and an array. I want a code to extract it. Now I want extract the array from the object and assign it to an array variable so I can loop through it. Which means I must get rid of the first property.
UPDATE1
I want the new object is extracted from the original object by code rather than hard code since we have many dynamic size array.
[0] { foo: 1, bar: 2}
[1] { foo: 3, bar: 4}
[2] { foo: 5, bar: 6}