title: Assign array of objects to variable though .subscribe()
body: <p>I'm following Angular.io guide <a href="https://angular.io/guide/router#route-parameters-in-the-activatedroute-service" rel="nofollow noreferrer">https://angular.io/guide/router#route-parameters-in-the-activatedroute-service</a>. They used  <code>| async</code> which is not clear for me and I decided to make some custimization. I wanted to <strong>Assign array of objects to variable though .subscribe()</strong> but it doesn't work out((
  <br>
  <br>
  here is a part of my code
  <br>
  <br>
  <strong>main</strong></p>
  
  <pre><code>ngOnInit() {
  this.heroes$ = this.route.paramMap.switchMap((params: ParamMap) =&gt; {
    this.selectedId = params.get('id');
    return this.heroService.getHeroes();
  
  });
   this.heroes$.subscribe((heroes: Hero[]) =&gt; {
     this.heroes == heroes
     console.log(heroes) // Shows array of Objects
     console.log(this.heroes) // Shows undefined
   })
  </code></pre>
  
  <p><hr>
  <strong>heroService</strong></p>
  
  <pre><code>getHeroes() { return Observable.of(HEROES); }
  </code></pre>
  
  <p><hr>
  <strong>HEROES</strong></p>
  
  <pre><code>import { Hero } from './hero';
  
  export const HEROES: Hero[] = [
    { id: 11, name: 'Mr. Nice' },
    { id: 12, name: 'Narco' },
    { id: 13, name: 'Bombasto' },
    { id: 14, name: 'Celeritas' },
    { id: 15, name: 'Magneta' },
    { id: 16, name: 'RubberMan' },
    { id: 17, name: 'Dynama' },
    { id: 18, name: 'Dr IQ' },
    { id: 19, name: 'Magma' },
    { id: 20, name: 'Tornado' }
  ];
  </code></pre>