Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

116
Views
NodeJS/Java Script Push Object

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 }
]
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!