Error: Cannot read property \'push\' of undefined in [null].
class A implements OnInit { stringArr: string[];
class A implements OnInit { stringArr: string=[]; ngOnInit() { for(let i=0; i<4; i++) { this.stringArr.push("aaa"); } } }
Here stringArr is defined as string, but not as an array of string. Define stringArr as blank array [].
stringArr