I'm not sure if this is the place for this question, but I was told that the code review is not for this.
I'm just learning Angular 2 and Typescript, so I'm working on this next tutorial:
https://angular.io/docs/ts/latest/tutorial/toh-pt4.html
Between the third and fourth declaration of the heroes variable in app.component.ts changes:
export class AppComponent { heroes = HEROES; }
in
export class AppComponent { heroes: Hero[]; }
I understand that the first sets it to the constant of the array of heroes, but why does the second use a colon, and not just set it to an empty array?
Changing the second to = actually causes the expected expression error, so I'm just trying to understand the differences between them.
source share