'NodeJS/Java Script Push Object [duplicate]

Iam from java background, why does for loop does not create object with 10 values starting from 0 to 9

let myobj={id:""}
let myobjArray=[]
for(let i=0;i<10;i++){
myobj.id=i
console.log(myobj);
myobjArray.push(myobj)
}
//Why does this object array does not print all from 0 to 9
console.log(myobjArray)

Output:

{ id: 0 }
{ id: 1 }
{ id: 2 }
{ id: 3 }
{ id: 4 }
{ id: 5 }
{ id: 6 }
{ id: 7 }
{ id: 8 }
{ id: 9 }
[
  { id: 9 }, { id: 9 },
  { id: 9 }, { id: 9 },
  { id: 9 }, { id: 9 },
  { id: 9 }, { id: 9 },
  { id: 9 }, { id: 9 }
]


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source