# My Array does not execute for or foreach

**URL:** <https://forum.ionicframework.com/t/my-array-does-not-execute-for-or-foreach/145028>\
**Category:** ionic-v3\
**Created:** [October 19, 2018, 3:17pm UTC](https://forum.ionicframework.com/t/my-array-does-not-execute-for-or-foreach/145028 "2018-10-19T15:17:45Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [October 19, 2018, 9:50pm UTC](https://forum.ionicframework.com/t/my-array-does-not-execute-for-or-foreach/145028/17 "2018-10-19T21:50:10Z")

</div>

> [@easychurch](#):
>
> pipe(map(item =\> arr.push(item)))

`<img src="giant-flashing-siren.gif">`

You can’t pretend that asynchronous things are synchronous. `getVisitantesPorArray` cannot return `Array<User>`. I was under the impression that `forEach` was `Array.forEach`.

Now the entire discussion is radically different, and I don’t speak enough Portuguese to know what `getVisitantesPorArray` needs to be called, but it probably shouldn’t be that. See [this post](https://forum.ionicframework.com/t/access-the-selected-object-of-ngfor-into-ts/144746/11) for some background.

```auto
needsProperName(org: Org, visitantes: string[]): Observable<User[]> {
  return from(visitantes).pipe(
    mergeMap(vn => this.getVisitante(org, vn)),
    toArray()
  );
}

```

---

_[View the full topic](https://forum.ionicframework.com/t/my-array-does-not-execute-for-or-foreach/145028)._
