This is my data:
$scope.data = [
{
"top":"2",
"status":"1",
"name":"Anna",
},
{
"top":"2",
"status":"1",
"name":"Jodie",
},
{
"top":"2",
"status":"1",
"name":"susan",
}
];
Now I want to convert the objects to arrays. When I run my program I get this following output in console log:
{
"1":{
"2":"3"
}
}
But I need them to output as an array not object. Someone told me to use map function but I need to do them without using map function because it will cause a conflict in the process of my project. Is there any other way to do it without using map function?
The 1 in output means status object. 2 means top object and 3 means the number of students who's top is in 2.
This is the code I have so far: http://jsfiddle.net/DharkRoses/sjz5aLv1/
Any suggestions? TIA
Update: I want the output which looks like this:
(
[1] =>Array
(
[2] => 3
)
)