我试图将一个有值的对象推送到一个Array
,但是在控制台中总是得到null
不是一个对象。但是当我打印出这个对象时,它是填充的而不是null
,那么为什么我不能将它推入到数组中呢?
let obj: Lektion;
obj = {
LektionID: data2.string[0],
Date: data2.string[1],
StudentID: data2.string[2],
Name: data2.string[3],
Status: (data2.string[4] !== '0'),
TeacherID: data2.string[5]
};
console.log(obj);
this.Lektionen.push(obj);