У меня есть ошибка, но я не знаю, что еще нужно сделать, чтобы ее исправить.Ниже приведен мой код и ошибка:
courses: any[] = [];
ngOnInit() {
this.locale = this.localeService.currentLocale();
this.user = this.authService.getCurrentUser();
this.userService.getCoursesInProgress(this.user.id).subscribe(courses => {
this.coursesInProgress = [];
courses.forEach(n => {
const courseObj: Course = new Course(n);
this.coursesInProgress.push(courseObj);
});
});
this.userService.getCoursesFinished(this.user.id).subscribe(courses => {
this.coursesFinished = [];
courses.forEach(n => {
const courseObj: Course = new Course(n);
this.coursesFinished.push(courseObj);
});
});
}
TypeError · Невозможно прочитать свойство 'forEach' из неопределенного