I have this class in TypeScript
export class PageModel {
constructor () {
}
Name: string;
Content: string;
Url: string;
}
And I created an array of this class
let test: PageModel[];
test = new Array(21);
test.fill(new PageModel());
test.fill(new PageModel());
I set this array with two instances:
test[0].Content = 'Firt instatance';
test[1].Content = 'Second instatance' ;
console.log (test[0].Content + test[1].Content);
However, in the console it is shown 'Second instance Second instance'
The second value writes the first value.
Is there any way to solve this problem?