function ngOnInit() {
let ref1 = {
foo: 'bar'
};
let ref2 = ref1;
ref2 = null;
console.log(ref1, ref2);
}
ngOnInit();
I would expect to see ref1 and ref2 both equal to NULL but they are not. In the console they report
ref1: Object { foo: "bar" }
ref2: null
is this expected? If so how do I pass by reference?