Question: I have an array of **position** and nested **user** objects like so:

```
[ 
  position: {
    title: Developer,
    user: { name: Albert }
    },
  position: {
    title: CEO,
    user: { name: Smith }
    }
] 

```

How do I get an array of [user, user] with Angularjs?

Answer: 
I just tried this code, and works ...

```
var positions, users;

users = [];
positions = [
  {
    title: 'Developer',
    user: { name: 'Albert' }
  },
  {
    title: 'CEO',
    user: { name: 'Smith' }
  }
];

angular.forEach(positions, function(position) {
  users.push(position.user);
});

console.log(users);

```
Use `angular.forEach()`:

```
var arr1=[]
var arr=[ 
  position: {
    title: Developer,
    user: { name: Albert }
    },
  position: {
    title: CEO,
    user: { name: Smith }
    }
];
angular.forEach(arr,function(value,key){
   arr1[key]=value.position.user;
});
console.log(arr1);

```