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

235
Views
When I store an object in an array, what mechanism is at work here?
 let kim={
     a:1,
     b:2
}
console.log(kim);
let tip=["a","b",kim];
console.log(tip);
kim.a=2;
console.log(tip);
console.log(kim);

output

>{a: 1, b: 2}
['a', 'b', {…}]0: "a"1: "b"2: {a: 2, b: 2}:length: 3[[Prototype]]: Array(0)
['a', 'b', {…}]0: "a"1: "b"2: {a: 2, b: 2}length: 3[[Prototype]]: Array(0)
{a: 2, b: 2}

expect

{a: 1, b: 2}
['a', 'b', {…}]0: "a"1: "b"2: {**a: 1**, b: 2}:length: 3[[Prototype]]: Array(0)
['a', 'b', {…}]0: "a"1: "b"2: {a: 2, b: 2}length: 3[[Prototype]]: Array(0)
{a: 2, b: 2}

Kim.a was changed 1 to 2 after first tip print, but first tip print is changed 2 before kim.a changed. What mechanism is at work here?

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!