I am absolute beginner on TypeScript. I want to initialize an array of numbers in TypeScript by "for" loop as you see in the following:
public hours: number[];
constructor() {
for (let i: number = 1; i < 25; i++) {
this.hours[i] = i;
}
}
I get an error: Cannot set property '1' of undefined. Could you please help me?
hours = new Array()