[Angular] console.log 顯示不正確?

可以看到程式中和瀏覽器顯示的值
在 result.bindParameter可以看到結構為單筆的

可以看到程式中和瀏覽器顯示的值
在 result.bindParameter可以看到結構為單筆的

但點開後會看到變成雙筆資料
其實這是因為瀏覽器console.log()呈現的是記憶體位址

所以的確 console.log('result.bindParameter length',result.bindParameter.length);

這邊印出來的就是1筆,而一開始的確result.bindParameter也真的只有一筆資料
result.bindParameter.push 後續改變了記憶體位址、console.log的特性才導致顯示的是參考到的整個物件

而在了解特性的情況下

把程式改為

console.log 複製印出物件的話
他就會記在新的記憶體位址
而不會再被其他影響