In TypeScript, what is the difference between stations: any[];
and stations: any[] = [];
export class RoleConfigurationComponent implements OnInit {
stations: any[];
stations: any[] = [];
}
Can please anyone explain this.
stations: any[];
The above denotes the stations
is of type array of any
but its NOT initialized
stations: any[] = [];
The above denotes you are initializing
stations to an empty array
.