In the following code snippet, I am declaring an array within a class:
pastq:number[];
randomqnumber:number;
Inside an else statement within a function:
this.randomqnumber=Math.floor(Math.random() * homework.length)+1;
console.log(this.randomqnumber);//got the number
this.pastq.push(this.randomqnumber); // encountering issues here
console.log(this.pastq[0]); //not able to access element at index 0