I have a strange bug in my Angular code which I can't understand. I don't know whether it is related to the following behavior that I can't understand.
class Foo {
bar: string;
constructor(bar: string) {
this.bar = bar;
}
}
const fooList: Foo[] = [
new Foo('A')
];
console.log(fooList[0]);
console.log(fooList);
fooList.forEach(foo => console.log(foo));
fooList[0].bar = 'B';
I'm using Angular 8 and when I run it on Firefox I see the following
What could it be?