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

112
Views
Inconsistent javascript behavior when referencing array objects

Let's say hypothetically that we

  1. instantiated an array object
  2. referenced that array object in another array
  3. print out the array reference
  4. change the initial array's values
let initialArray = [1,2,3,4,5]
let referenceArray = [initialArray,6]
console.log(referenceArray)
initialArray.pop()

the output at chrome browser 96 Array(2) 0: (4) [1, 2, 3, 4] 1: 6 length: 2 However at nodeJs the output is [ [ 1, 2, 3, 4, 5 ], 6 ]

Why initialArray's value got popped at the browser but not nodeJs ?

Edit:
The referenced question states that it's fixed bug ,however the 10 years old question's error still persist , so it's clearly not related to such long-gone resolved bug .
Also the behavior i listed at this question only takes place when referencing another array object

let initialArray = [1,2,3,4,5] 
console.log(initialArray)
initialArray.pop()

normally outputs [1, 2, 3, 4, 5]

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!