0
I have this class in Typescript
export class PageModel {
constructor () {
}
Name: string;
Content: string;
Url: string;
}
And 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);
But in the console is shown 'Second instance Second instance'
The second value exceeds the first value.
Is there any way to solve this problem?
translated the post
– Claudio Fco R. Martins