Почему reduce выдает NaN?

Столкнулся с проблемой, когда я применяю метод reduce к массиву arrayOfGrades, мне возвращается NaN, вот данная строчка:

 this.avgMark = arrayOfGrades.reduce(function (sum,item) {
  sum += item
 }, 0) / arrayOfGrades.length; 

Код целиком:

class Student {
    constructor(firstName,lastName,yearOfBirth,arrayOfGrades) {
        this.firstName = firstName;
        this.lastName = lastName;
        this.yearOfBirth = yearOfBirth;
        this.arrayOfGrades = arrayOfGrades;
        this.age = new Date().getFullYear() - this.yearOfBirth;
        this.avgMark = arrayOfGrades.reduce(function (sum,item) {
            sum += item
        }, 0) / arrayOfGrades.length;

    }
    //______Возраст студента______//
    getAge () {
        return (`${this.firstName}'s old is ${this.age} years`);
    }
    //______Средний бал______//
    averageMark () {
        return(`${this.firstName}'s average mark is ${this.avgMark}`);
    }

}
const student = new Student('Dmitriy', 'Yaroshchuk', 2001, [70, 80, 90, 100, 90, 90, 99, 100, 95, 100]);
const student1 = new Student('Andrew', 'Kavetsky', 2000, [90, 90, 90, 90, 90, 90, 100, 100, 95, 93]);
const student2 = new Student('Diana', 'Koko', 1999, [70, 70, 70, 70, 70, 70, 75, 75, 75, 93]);


Ответы (0 шт):